content
stringlengths
7
2.61M
A sensor data streaming service for visualizing urban public spaces For understanding human activities in urban public spaces, we have been developing a sensing platform for visualizing data derived from sensor devices in the spaces. The platform collects sensing data from sensor devices installed in public spaces, and provide a simple communication interface to access the sensor data for client systems. In this demo abstract, we describe a working prototype of a sensor data streaming service for visualizing urban public spaces. The streaming data includes the number of pedestrians, pedestrian flows, and sound pressures of the human activities in the sensing area. As an application of the streaming service, we will show a client system that visualizes the current pedestrian flows in the sensing area with very little delay. The flows are visualized like a view of live camera without pedestrians' appearances. The system has a search interface to retrieve the sensing data in a past period and also visualizes them.
// ============================================================================ // // Copyright (C) 2006-2021 Talend Inc. - www.talend.com // // This source code is available under agreement available at // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt // // You should have received a copy of the agreement // along with this program; if not, write to Talend SA // 9 rue Pages 92150 Suresnes, France // // ============================================================================ package org.talend.core.model.metadata; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.talend.core.model.metadata.builder.connection.GenericPackage; import org.talend.core.model.properties.ConnectionItem; import org.talend.core.model.properties.Item; import org.talend.core.model.repository.EPackageType; import org.talend.cwm.helper.ConnectionHelper; import org.talend.cwm.xml.TdXmlSchema; import orgomg.cwm.foundation.softwaredeployment.Component; import orgomg.cwm.objectmodel.core.Dependency; import orgomg.cwm.objectmodel.core.ModelElement; import orgomg.cwm.resource.record.RecordFile; /** * hywang class global comment. Detailled comment */ public class MetadataManager { public static final String TYPE_TABLE = "TABLE"; //$NON-NLS-1$ public static final String TYPE_VIEW = "VIEW"; //$NON-NLS-1$ public static final String TYPE_SYNONYM = "SYNONYM"; //$NON-NLS-1$ public static final String TYPE_CALCULATION_VIEW = "CALCULATION VIEW"; //$NON-NLS-1$ public static final String TYPE_ALIAS = "ALIAS"; //$NON-NLS-1$ public static void addContents(ConnectionItem item, Resource itemResource) { List recordfiles = new ArrayList(); List generics = new ArrayList(); List xmlSchemas = new ArrayList(); List catalogsorSchemas = new ArrayList(); // MOD zshen for feature 14891 use same repository API with TOS to persistent metadata. List components = new ArrayList(); // MOD mzhao handle dependencies. List<Dependency> dependencies = new ArrayList<Dependency>(); getTypedPackges(item, recordfiles, EPackageType.RecordFile); getTypedPackges(item, generics, EPackageType.Generic); getTypedPackges(item, xmlSchemas, EPackageType.XML_Schema); getTypedPackges(item, catalogsorSchemas, EPackageType.DB_Schema); getTypedPackges(item, components, EPackageType.TDQ_compont); getTypedPackges(item, dependencies, EPackageType.Dependency); itemResource.getContents().add(item.getConnection()); if (!recordfiles.isEmpty()) { itemResource.getContents().addAll(recordfiles); // 13221 } if (!generics.isEmpty()) { itemResource.getContents().addAll(generics); } if (!xmlSchemas.isEmpty()) { itemResource.getContents().addAll(xmlSchemas); } if (!catalogsorSchemas.isEmpty()) { itemResource.getContents().addAll(catalogsorSchemas); } if (!components.isEmpty()) { itemResource.getContents().addAll(components); } if (!dependencies.isEmpty()) { itemResource.getContents().addAll(dependencies); } } public static void addPackges(Item item, List<EObject> objects) { if (item instanceof ConnectionItem) { ConnectionItem connItem = (ConnectionItem) item; List recordfiles = new ArrayList(); List generics = new ArrayList(); List xmlSchemas = new ArrayList(); List catalogsorSchemas = new ArrayList(); getTypedPackges(connItem, recordfiles, EPackageType.RecordFile); getTypedPackges(connItem, generics, EPackageType.Generic); getTypedPackges(connItem, xmlSchemas, EPackageType.XML_Schema); getTypedPackges(connItem, catalogsorSchemas, EPackageType.DB_Schema); if (!recordfiles.isEmpty()) { objects.addAll(recordfiles); // 13221 } if (!generics.isEmpty()) { objects.addAll(generics); } if (!xmlSchemas.isEmpty()) { objects.addAll(xmlSchemas); } if (!catalogsorSchemas.isEmpty()) { objects.addAll(catalogsorSchemas); } } } public static void getTypedPackges(ConnectionItem item, List returnlist, EPackageType pkgType) { switch (pkgType) { case Generic: for (int i = 0; i < item.getConnection().getDataPackage().size(); i++) { if (item.getConnection().getDataPackage().get(i) instanceof GenericPackage) { GenericPackage gpkg = (GenericPackage) item.getConnection().getDataPackage().get(i); returnlist.add(gpkg); } } break; case DB_Catalog: case DB_Schema: Collection<? extends ModelElement> catalogsorSchemas = ConnectionHelper.getCatalogs(item.getConnection()); if (catalogsorSchemas.size() == 0) { catalogsorSchemas = ConnectionHelper.getSchema(item.getConnection()); } returnlist.addAll(catalogsorSchemas); break; case RecordFile: for (int i = 0; i < item.getConnection().getDataPackage().size(); i++) { if (item.getConnection().getDataPackage().get(i) instanceof RecordFile) { RecordFile rf = (RecordFile) item.getConnection().getDataPackage().get(i); // add for TDI-22857 item.getConnection().setName(item.getProperty().getDisplayName()); if (rf != null) { rf.setName("default"); //$NON-NLS-1$ } returnlist.add(rf); } } break; case XML_Schema: // for mdm for (int i = 0; i < item.getConnection().getDataPackage().size(); i++) { if (item.getConnection().getDataPackage().get(i) instanceof TdXmlSchema) { TdXmlSchema xml = (TdXmlSchema) item.getConnection().getDataPackage().get(i); returnlist.add(xml); } } break; case TDQ_compont: if (item.getConnection().getComponent() instanceof Component) { Component component = item.getConnection().getComponent(); returnlist.add(component); } break; case Dependency: List<Dependency> dependencies = item.getConnection().getSupplierDependency(); returnlist.addAll(dependencies); break; default: } } }
/** * Abstract base class functions to get/send messages to a remote queue. * * @author Subho Ghosh (subho dot ghosh at outlook.com) * @created 04/09/14 */ public abstract class Publisher<M> extends Client<M> { /** * Add a new message to the remote queue. * * @param message - Message to send. * @throws ClientException * @throws ConnectionException */ public abstract void send(M message) throws ClientException, ConnectionException; /** * Add a batch of messages to the remote queue. * * @param messages - Batch of messages to send. * @throws ClientException * @throws ConnectionException */ public abstract void send(List<M> messages) throws ClientException, ConnectionException; }
<gh_stars>0 import sys from tqdm import tqdm from PyPDF2 import PdfFileReader pdffile = PdfFileReader("statement.pdf", "rb") if pdffile.isEncrypted == False: print ("[!] The file is not protected with any password. Exiting.") exit print ("[+] Attempting to Brute force. This will take time...") z = "" for i in tqdm(range(999999, 0, -1)): z = str (i) while (len(z) < 6): z = "0" + z # The password is of the format : "<PASSWORD>" , where "<PASSWORD>" is a 6 digit unknown number. a = str("1051-0981-" + str(z) + "-01-8") if pdffile.decrypt(a) > 0: print ("[+] Password is: " + a) print ("[...] Exiting..") sys.exit()
from msdsl.expr.format import SIntFormat, UIntFormat def generic_test(cls, pairs): for x, width in pairs: assert cls.width_of(x) == width def test_sint_width(): pairs = [] # simple tests pairs += [ (0, 1), (1, 2), (2, 3), (-1, 1), (-2, 2), (-3, 3), (126, 8), (127, 8), (128, 9), (-127, 8), (-128, 8), (-129, 9) ] # stress tests for n in range(10, 100): pairs += [ ((1<<(n-1))-2, n), ((1<<(n-1))-1, n), ((1<<(n-1))-0, n+1), ((1<<(n-1))+1, n+1), ((-(1<<(n-1)))+1, n), ((-(1<<(n-1)))-0, n), ((-(1<<(n-1)))-1, n+1), ((-(1<<(n-1)))-2, n+1) ] # run tests generic_test(cls=SIntFormat, pairs=pairs) def test_uint_width(): pairs = [] # simple tests pairs += [ (0, 1), (1, 1), (2, 2), (3, 2), (126, 7), (127, 7), (128, 8) ] # stress tests for n in range(10, 100): pairs += [ ((1<<n)-2, n), ((1<<n)-1, n), ((1<<n)-0, n+1), ((1<<n)+1, n+1) ] # run tests generic_test(cls=UIntFormat, pairs=pairs)
Optimized PCR with sequence specific primers (PCR-SSP) for fast and efficient determination of Interleukin-6 Promoter -597/-572/-174Haplotypes Background Interleukin-6 (IL-6) promoter polymorphisms at positions -597(G→A), -572(G→C) and -174(G→C) were shown to have a clinical impact on different major diseases. At present PCR-SSP protocols for IL-6 -597/-572/-174haplotyping are elaborate and require large amounts of genomic DNA. Findings We describe an improved typing technique requiring a decreased number of PCR-reactions and a reduced PCR-runtime due to optimized PCR-conditions. Conclusion This enables a fast and efficient determination of IL-6 -597/-572/-174haplotypes in clinical diagnosis and further evaluation of IL-6 promoter polymorphisms in larger patient cohorts. Findings Interleukin-6 (IL-6) is a pleiotropic cytokine with a broad range of effects that is produced by a variety of different cells and plays a crucial role at the interface of adoptive and innate immunity. The increased knowledge about individual genetic susceptibility of the immune system led to the identification of three single biallelic nucleotide polymorphisms (SNP) within the promoter region of the IL-6 gene at positions -597(G A) (rs1800797), -572(G C) (rs1800796) and -174(G C) (rs1800795). The three SNPs were shown to be in linkage disequilibrium and naturally occurring IL-6 -597/-572/-174 haplotypes have been characterized. At present, typing of IL-6 -597/-572/-174 haplotypes requires an elaborate and time-consuming protocol. A twelvereaction PCR-SSP system with eight different allele-specific primers (AS1-AS8) is needed in order to identify both -597/-572/-174 haplotypes for the three biallelic sites in each individual tested. Since PCR-SSP is DNA-consuming, this procedure requires at least 500 ng genomic DNA; this, however, may be critical with regard to a retrospective analysis, or when valuable samples need to be analyzed. However for subsequent confirmatory investigations of Here we report a modified PCR-SSP protocol which is suitable for the genotyping of IL-6 -597/-572/-174 haplotypes in the Caucasian population. It is faster, less labour-intensive and requires less DNA, since only four instead of twelve PCR reactions are necessary in order to detect all relevant -597/-572/-174 haplotypes in the Caucasian population (Table 1). For the isolation of genomic DNA from 200 L whole blood, we used the QIAamp® DNA Blood Mini Kit (Qiagen, Hilden, Germany) according to the manufacturer's standard protocol. The DNA concentration was estimated from the absorbance at 260 nm using a UV-spectrophotometer (GeneQuant pro; Amersham Biosciences, Freiburg, Germany). For validation, DNA samples (n = 100) from a previous study genotyped according to the protocol by Terry et al. were used. According to an optimized protocol for PCR-SSP reactions were carried out in a total volume of 10 L, IV AS4-F3c AS7-R1c Additional validation of the technique could be achieved by retyping 100 healthy blood donor samples previously genotyped according to the protocol by Terry et al.. Our modified technique confirmed all previous typing results unambiguously (data not shown). PCR-SSP techniques are widely employed for the genotyping of SNPs. After PCR and agarose gel electrophoresis, the genotyping result is evaluated by the presence or absence of an allele-specific PCR product. Moreover, PCR-SSP-typing is suitable for haplotyping of neighbouring SNPs; furthermore, the presence of two alleles on one chromosome can be demonstrated when two appropriate allele-specific primers are combined in a single PCR-reaction. Consequently, complete typing of three neighbouring biallelic SNPs requires twelve PCRreactions! Since this procedure is very extensive and time-consuming it is not suitable for the typing of larger cohorts. In our study, we describe a modified PCR-SSP protocol which is suitable for rapid IL-6 -597/-572/-174 haplotyping focusing on the four major -597/-572/-174 haplotypes (AGC, GGC, GGG, GCG) representing 99.9% of all haplotypes in the Caucasian population (Table 1). Since only four, instead of twelve, PCR-reactions are needed and a protocol with optimized sensitivity is used, the amount of required genomic DNA could be reduced from 500 to 100 ng per genotype. This can be extremely valuable, especially if samples of limited quantity have to be analyzed. Notably, our protocol does not distinguish between the GGG and AGG -597/-572/-174 haplotype, which has only been detected in one Caucasian individual so far (Table 1). However, as its frequency is extremely low (0.1%), this would not affect the overall outcome of association studies. Furthermore, ACC, ACG and GCC also represent minor 597/-572/-174 haplotypes that cannot be distinguished likewise. Even though they have not been observed among Caucasians and are only of theoretical importance, it cannot be ruled out that they might occur in other populations as well. In order to run all four PCR-reactions under identical conditions, we optimized the selection of the allele-specific primers. Thereby, the runtime of the PCR-procedure could be reduced from 110 to 68 min with an overall analysis time of approximately 2 hours including all pipetting procedures, DNA-isolation (30 min), electrophoresis (10 min) and documentation (5 min). In summary, we optimized a previous PCR-SSP protocol for IL-6 -597/-572/174 haplo-typing of Caucasian individuals with regard to the number of PCR-reactions, the amount of genomic DNA required and overall runtime. This method represents an important prerequisite for further evaluating the clinical impact of IL-6 promoter polymorphisms in larger cohorts.
def prediction_rankings(self): overall_data = filter_nan(nanmeanw(self.rest, 1)).reshape( -1, self.rest.shape[2] ) overall = rank_test_2d(overall_data) steps = rank_test_3d(self.rest) return overall, steps
Interleukin1 orchestrates underlying inflammatory responses in microglia via Krppellike factor 4 Microglia are the resident macrophages of the CNS, which secrete several pro and antiinflammatory cytochemokines including interleukin1 (IL1), in response to pathogenic stimuli. Once secreted, IL1 binds to IL1 receptor present on microglia and initiates the production of inflammatory cytokines in microglia. However, the detailed information regarding the molecular mechanisms of IL1 triggered inflammatory pathways in microglia is lacking. Our studies focused on the role of Krppellike factor 4 (Klf4) in mediating the regulation of proinflammatory gene expression upon IL1 stimulation in microglia. Our studies show that stimulation of microglia with IL1 robustly induces Klf4 via PI3K/Akt pathway which positively regulates the production of endogenous IL1 as well as other proinflammatory markers, cyclooxygenase2, monocyte chemoattractant protein1 and interleukin6 (IL6). In addition, we report that Klf4 negatively regulates the expression of inducible nitric oxide synthase, thereby playing a key role in regulating the immunomodulatory activities of microglia.
Cross-cultural perspectives on gerontology in nursing education a qualitative study of nurse educators experiences ABSTRACT This study focuses on nurse educators perspectives on teaching gerontology within nursing curricula in two cultures. An increasing aging multi-cultural population with large caring needs requires not only informal elder care provided by family members, but also professional nursing staff trained in gerontology. The aim of this study was to explore how Swedish and Thai nurse educators describe the role of teaching gerontology within nursing educations in Sweden and Thailand. Method: Qualitative open-ended interviews with 13 Swedish and Thai nurse educators were conducted and analyzed with qualitative content analysis. Findings: There is a lack of gerontological nursing competence in faculty, as well as bureaucracy impeding necessary changes of curricula, together with difficulties in highlighting positive and cultural aspects of aging. Conclusions: Pedagogical strategies need to be developed by nurse educators specialized in cross-cultural gerontology to improve current and future nursing educations in both countries.
<reponame>goutham106/GmRxJavaRetrofit<gh_stars>0 package com.gm.gmrxjavaretrofit.recipy; import dagger.Module; import dagger.Provides; /** * Name : Gowtham * Created on : 20/2/17. * Email : <EMAIL> * GitHub : https://github.com/goutham106 */ @Module public class recipyModule { @Provides @recipy public recipyPresenter providePresenter(recipyPresenterImpl presenter) { return presenter; } @Provides @recipy public recipyInteractor provideInteractor(recipyInteractorImpl interactor) { return interactor; } }
/// Load events surounding the given event. pub(crate) fn load_event_context( connection: &rusqlite::Connection, event: &Event, before_limit: usize, after_limit: usize, ) -> rusqlite::Result<EventContext> { let mut profiles: HashMap<String, Profile> = HashMap::new(); let room_id = Database::get_room_id(connection, &event.room_id)?; let before = if before_limit == 0 { vec![] } else { let mut stmt = connection.prepare( " WITH room_events AS ( SELECT * FROM events WHERE room_id == ?2 ) SELECT source, sender, displayname, avatar_url FROM room_events INNER JOIN profile on profile.id = room_events.profile_id WHERE ( (event_id != ?1) & (server_ts <= ?3) ) ORDER BY server_ts DESC LIMIT ?4 ", )?; let context = stmt.query_map( &vec![ &event.event_id as &dyn ToSql, &room_id, &event.server_ts, &(after_limit as i64), ], |row| { Ok(( row.get(0), row.get(1), Profile { displayname: row.get(2)?, avatar_url: row.get(3)?, }, )) }, )?; let mut ret: Vec<String> = Vec::new(); for row in context { let (source, sender, profile) = row?; profiles.insert(sender?, profile); ret.push(source?) } ret }; let after = if after_limit == 0 { vec![] } else { let mut stmt = connection.prepare( " WITH room_events AS ( SELECT * FROM events WHERE room_id == ?2 ) SELECT source, sender, displayname, avatar_url FROM room_events INNER JOIN profile on profile.id = room_events.profile_id WHERE ( (event_id != ?1) & (server_ts >= ?3) ) ORDER BY server_ts ASC LIMIT ?4 ", )?; let context = stmt.query_map( &vec![ &event.event_id as &dyn ToSql, &room_id, &event.server_ts, &(after_limit as i64), ], |row| { Ok(( row.get(0), row.get(1), Profile { displayname: row.get(2)?, avatar_url: row.get(3)?, }, )) }, )?; let mut ret: Vec<String> = Vec::new(); for row in context { let (source, sender, profile) = row?; profiles.insert(sender?, profile); ret.push(source?) } ret }; Ok((before, after, profiles)) }
use std::collections::{hash_map, HashMap, HashSet}; use std::fmt::Debug; use std::hash::Hash; use crate::ast; use crate::diagnostic::{self, Diagnostic, DiagnosticKind}; use crate::parser::ParseFileResult; use crate::traverse; pub(crate) fn validate<ID>( keys: HashMap<String, ast::ItemKind>, lalrpop_results: HashMap<ID, ParseFileResult<ID>>, ) -> HashMap<ID, ParseFileResult<ID>> where ID: Eq + Hash + Clone + Debug, { lalrpop_results .into_iter() .map(|(id, mut fr)| { let mut ast = match fr.ast { Some(f) => f, None => return (id, ParseFileResult { ast: None, ..fr }), }; // Imports as qualified names let imports: HashSet<String> = ast.imports.iter().map(|i| i.get_qualified_name()).collect(); // Declared parcelables as qualified names let declared_parcelables: HashSet<String> = ast .declared_parcelables .iter() .map(|i| i.get_qualified_name()) .collect(); // Resolve types (check custom types and set definition if found in imports) let resolved = resolve_types( &mut ast, &imports, &declared_parcelables, &keys, &mut fr.diagnostics, ); // Check imports (e.g. unresolved, unused, duplicated) let import_map = check_imports(&ast.imports, &resolved, &keys, &mut fr.diagnostics); // Check declared parcelables check_declared_parcelables( &ast.declared_parcelables, &import_map, &resolved, &mut fr.diagnostics, ); // Check types (e.g.: map parameters) check_types(&ast, &mut fr.diagnostics); if let ast::Item::Interface(ref mut interface) = ast.item { // Set up oneway interface (adjust methods to be oneway) set_up_oneway_interface(interface, &mut fr.diagnostics); } // Check methods (e.g.: return type of async methods) check_methods(&ast, &mut fr.diagnostics); // Sort diagnostics by line fr.diagnostics.sort_by_key(|d| d.range.start.line_col.0); ( id, ParseFileResult { ast: Some(ast), ..fr }, ) }) .collect() } fn set_up_oneway_interface(interface: &mut ast::Interface, diagnostics: &mut Vec<Diagnostic>) { if !interface.oneway { return; } interface .elements .iter_mut() .filter_map(|el| match el { ast::InterfaceElement::Const(_) => None, ast::InterfaceElement::Method(m) => Some(m), }) .for_each(|method| { if method.oneway { diagnostics.push(Diagnostic { kind: DiagnosticKind::Warning, range: method.oneway_range.clone(), message: format!( "Method `{}` of oneway interface does not need to be marked as oneway", method.name ), context_message: Some("redundant oneway".to_owned()), hint: None, related_infos: Vec::from([diagnostic::RelatedInfo { message: "oneway interface".to_owned(), range: interface.symbol_range.clone(), }]), }); } else { // Force me method.oneway = true; } }); } fn resolve_types( ast: &mut ast::Aidl, imports: &HashSet<String>, declared_parcelables: &HashSet<String>, defined: &HashMap<String, ast::ItemKind>, diagnostics: &mut Vec<Diagnostic>, ) -> HashSet<String> { let mut resolved = HashSet::new(); traverse::walk_types_mut(ast, |type_: &mut ast::Type| { resolve_type(type_, imports, declared_parcelables, defined, diagnostics); if let ast::TypeKind::Resolved(key, _) = &type_.kind { resolved.insert(key.clone()); } }); resolved } fn resolve_type( type_: &mut ast::Type, imports: &HashSet<String>, declared_parcelables: &HashSet<String>, defined: &HashMap<String, ast::ItemKind>, diagnostics: &mut Vec<Diagnostic>, ) { if type_.kind == ast::TypeKind::Unresolved { if let Some(import_path) = imports.iter().find(|import_path| { &type_.name == *import_path || import_path.ends_with(&format!(".{}", type_.name)) }) { // Type has been imported let opt_item_kind = defined.get(import_path); type_.kind = ast::TypeKind::Resolved(import_path.to_owned(), opt_item_kind.cloned()); } else if let Some(import_path) = declared_parcelables.iter().find(|import_path| { &type_.name == *import_path || import_path.ends_with(&format!(".{}", type_.name)) }) { // Type is a forward-declared parcelable type_.kind = ast::TypeKind::Resolved(import_path.to_owned(), None); } else { // Unresolved type diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: type_.symbol_range.clone(), message: format!("Unknown type `{}`", type_.name), context_message: Some("unknown type".to_owned()), hint: None, related_infos: Vec::new(), }); } } } fn check_imports<'a, 'b>( imports: &'a [ast::Import], resolved: &'a HashSet<String>, defined: &'a HashMap<String, ast::ItemKind>, diagnostics: &'b mut Vec<Diagnostic>, ) -> HashMap<String, &'a ast::Import> { // - detect duplicated imports // - create map of "qualified name" -> Import let imports: HashMap<String, &ast::Import> = imports.iter().fold(HashMap::new(), |mut map, import| { match map.entry(import.get_qualified_name()) { hash_map::Entry::Occupied(previous) => { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: import.symbol_range.clone(), message: format!("Duplicated import `{}`", import.get_qualified_name()), context_message: Some("duplicated import".to_owned()), hint: None, related_infos: Vec::from([diagnostic::RelatedInfo { message: "previous location".to_owned(), range: previous.get().symbol_range.clone(), }]), }); } hash_map::Entry::Vacant(v) => { v.insert(import); } } map }); // - generate diagnostics for unused and unresolved imports for (qualified_import, import) in imports.iter() { if !defined.contains_key(qualified_import) { // No item can be found with the given import path diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: import.symbol_range.clone(), message: format!("Unresolved import `{}`", import.name), context_message: Some("unresolved import".to_owned()), hint: None, related_infos: Vec::new(), }); } else if !resolved.contains(qualified_import) { // No type resolved for this import diagnostics.push(Diagnostic { kind: DiagnosticKind::Warning, range: import.symbol_range.clone(), message: format!("Unused import `{}`", import.name), context_message: Some("unused import".to_owned()), hint: None, related_infos: Vec::new(), }); } } imports } fn check_declared_parcelables( declared_parcelables: &[ast::Import], imports: &HashMap<String, &ast::Import>, resolved: &HashSet<String>, diagnostics: &mut Vec<Diagnostic>, ) { // - detect duplicated parcelables (or name which was already imported) // - create map "qualified name" -> Import let declared_parcelables: HashMap<String, &ast::Import> = declared_parcelables .iter() .fold(HashMap::new(), |mut map, declared_parcelable| { let qualified_name = declared_parcelable.get_qualified_name(); if let Some((_, conflicting_import)) = imports .iter() .find(|(_, import)| import.name == declared_parcelable.name) { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: declared_parcelable.symbol_range.clone(), message: format!( "Declared parcelable conflicts with import `{}`", qualified_name ), context_message: Some("conflicting declaration".to_owned()), hint: None, related_infos: Vec::from([diagnostic::RelatedInfo { message: "location of conflicting import".to_owned(), range: conflicting_import.symbol_range.clone(), }]), }); return map; } match map.entry(qualified_name.clone()) { hash_map::Entry::Occupied(previous) => { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: declared_parcelable.symbol_range.clone(), message: format!( "Multiple parcelable declarations `{}`", qualified_name ), context_message: Some("duplicated declaration".to_owned()), hint: None, related_infos: Vec::from([diagnostic::RelatedInfo { message: "previous location".to_owned(), range: previous.get().symbol_range.clone(), }]), }); } hash_map::Entry::Vacant(v) => { v.insert(declared_parcelable); } } map }); // - generate diagnostics for unrecommended usage and for unused declared parcelables for (qualified_import, declared_parcelable) in declared_parcelables.into_iter() { if !resolved.contains(&qualified_import) { // No type resolved for this import diagnostics.push(Diagnostic { kind: DiagnosticKind::Warning, range: declared_parcelable.symbol_range.clone(), message: format!("Unused declared parcelable `{}`", declared_parcelable.name), context_message: Some("unused declared parcelable".to_owned()), hint: None, related_infos: Vec::new(), }); } else { diagnostics.push(Diagnostic { kind: DiagnosticKind::Warning, range: declared_parcelable.symbol_range.clone(), message: format!("Usage of declared parcelable `{}`", declared_parcelable.name), context_message: Some(String::from("declared parcelable")), hint: Some(String::from("It is recommended to defined parcelables in AIDL to garantee compatilibity between languages")), related_infos: Vec::new(), }); } } } fn check_types(ast: &ast::Aidl, diagnostics: &mut Vec<Diagnostic>) { traverse::walk_types(ast, |type_: &ast::Type| check_type(type_, diagnostics)); } fn check_type(type_: &ast::Type, diagnostics: &mut Vec<Diagnostic>) { match &type_.kind { ast::TypeKind::Array => { let value_type = &type_.generic_types[0]; check_array_element(value_type, diagnostics); } ast::TypeKind::List => { // Handle wrong number of generics match type_.generic_types.len() { 0 => { diagnostics.push(Diagnostic { kind: DiagnosticKind::Warning, message: String::from("Declaring a non-generic list is not recommended"), context_message: Some("non-generic list".to_owned()), range: type_.symbol_range.clone(), hint: Some("consider adding a parameter (e.g.: List<String>)".to_owned()), related_infos: Vec::new(), }); return; } 1 => (), _ => unreachable!(), // handled via lalrpop rule } let value_type = &type_.generic_types[0]; check_list_element(value_type, diagnostics); } ast::TypeKind::Map => { // Handle wrong number of generics match type_.generic_types.len() { 0 => { diagnostics.push(Diagnostic { kind: DiagnosticKind::Warning, message: String::from("Declaring a non-generic map is not recommended"), context_message: Some("non-generic map".to_owned()), range: type_.symbol_range.clone(), hint: Some( "consider adding key and value parameters (e.g.: Map<String, String>)" .to_owned(), ), related_infos: Vec::new(), }); return; } 2 => (), _ => unreachable!(), // handled via lalrpop rule } // Handle invalid generic types check_map_key(&type_.generic_types[0], diagnostics); check_map_value(&type_.generic_types[1], diagnostics); } _ => {} }; } fn check_methods(file: &ast::Aidl, diagnostics: &mut Vec<Diagnostic>) { let mut method_names: HashMap<String, &ast::Method> = HashMap::new(); let mut first_method_without_id: Option<&ast::Method> = None; let mut first_method_with_id: Option<&ast::Method> = None; let mut method_ids: HashMap<u32, &ast::Method> = HashMap::new(); traverse::walk_methods(file, |method: &ast::Method| { // Check individual method (e.g. return value, args, ...) check_method(method, diagnostics); if let Some(previous) = method_names.get(&method.name) { // Found already exists => ERROR diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: method.symbol_range.clone(), message: format!("Duplicated method name `{}`", method.name), context_message: Some("duplicated method name".to_owned()), hint: None, related_infos: Vec::from([diagnostic::RelatedInfo { message: "previous location".to_owned(), range: previous.symbol_range.clone(), }]), }); return; } method_names.insert(method.name.clone(), method); let is_mixed_now_with_id = first_method_with_id.is_none() && first_method_without_id.is_some() && method.value.is_some(); let is_mixed_now_without_id = first_method_without_id.is_none() && !method_ids.is_empty() && method.value.is_none(); if is_mixed_now_with_id || is_mixed_now_without_id { let info_previous = if is_mixed_now_with_id { diagnostic::RelatedInfo { message: "method without id".to_owned(), range: first_method_without_id .as_ref() .unwrap() .value_range .clone(), } } else { diagnostic::RelatedInfo { message: "method with id".to_owned(), range: first_method_with_id.as_ref().unwrap().value_range.clone(), } }; // Methods are mixed (with/without id) diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: method.value_range.clone(), message: String::from("Mixed usage of method ids"), context_message: None, hint: Some(String::from( "Either all methods should have an id or none of them", )), related_infos: Vec::from([info_previous]), }); } if method.value.is_some() { // First method with id if first_method_with_id.is_none() { first_method_with_id = Some(method); } } else { // First method without id if first_method_without_id.is_none() { first_method_without_id = Some(method); } } if let Some(id) = method.value { match method_ids.entry(id) { hash_map::Entry::Occupied(oe) => { // Method id already defined diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, range: method.value_range.clone(), message: String::from("Duplicated method id"), context_message: Some("duplicated import".to_owned()), hint: None, related_infos: Vec::from([diagnostic::RelatedInfo { range: oe.get().value_range.clone(), message: String::from("previous method"), }]), }); } hash_map::Entry::Vacant(ve) => { // First method with this id ve.insert(method); } } } }); } fn check_method(method: &ast::Method, diagnostics: &mut Vec<Diagnostic>) { if method.oneway && method.return_type.kind != ast::TypeKind::Void { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!( "Invalid return type of async method `{}`", method.return_type.name, ), context_message: Some("must be void".to_owned()), range: method.return_type.symbol_range.clone(), hint: Some("return type of async methods must be `void`".to_owned()), related_infos: Vec::new(), }); } check_method_args(method, diagnostics); } // Check arg direction (e.g. depending on type or method being oneway) fn check_method_args(method: &ast::Method, diagnostics: &mut Vec<Diagnostic>) { for arg in &method.args { // Range of direction (or position of arg type) let range = match &arg.direction { ast::Direction::In(range) | ast::Direction::Out(range) | ast::Direction::InOut(range) => range.clone(), ast::Direction::Unspecified => ast::Range { start: arg.arg_type.symbol_range.start.clone(), end: arg.arg_type.symbol_range.start.clone(), }, }; match get_requirement_for_arg_direction(&arg.arg_type) { RequirementForArgDirection::DirectionRequired(for_elements) => { if arg.direction == ast::Direction::Unspecified { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Missing direction for `{}`", arg.arg_type.name,), context_message: Some("missing direction".to_owned()), range: range.clone(), hint: Some(format!("direction is required for {}", for_elements)), related_infos: Vec::new(), }); } } RequirementForArgDirection::CanOnlyBeInOrUnspecified(for_elements) => { if !matches!( arg.direction, ast::Direction::Unspecified | ast::Direction::In(_) ) { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid direction for `{}`", arg.arg_type.name), context_message: Some("invalid direction".to_owned()), range: range.clone(), hint: Some(format!("{} can only be `in` or omitted", for_elements,)), related_infos: Vec::new(), }); } } RequirementForArgDirection::CanOnlyBeInOrInOut(for_elements) => { if !matches!( arg.direction, ast::Direction::In(_) | ast::Direction::InOut(_) ) { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid direction for `{}`", arg.arg_type.name), context_message: Some("invalid direction".to_owned()), range: range.clone(), hint: Some(if matches!(arg.direction, ast::Direction::Out(_)) { format!("{} cannot be out", for_elements,) } else { format!("{} must be specified", for_elements,) }), related_infos: Vec::new(), }); } } RequirementForArgDirection::CannotBeAnArg(for_elements) => { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid argument `{}`", arg.arg_type.name,), context_message: Some("invalid argument".to_owned()), range: range.clone(), hint: Some(format!("{} cannot be an argument", for_elements)), related_infos: Vec::new(), }); } RequirementForArgDirection::NoRequirement => (), } if method.oneway && matches!( arg.direction, ast::Direction::Out(_) | ast::Direction::InOut(_) ) { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid direction for `{}`", arg.arg_type.name), context_message: Some("invalid direction".to_owned()), range, hint: Some( "arguments of oneway methods can be neither `out` nor `inout`".to_owned(), ), related_infos: Vec::new(), }); } } } // Parameters describe for which elements the requirement applies enum RequirementForArgDirection { DirectionRequired(&'static str), CanOnlyBeInOrUnspecified(&'static str), CanOnlyBeInOrInOut(&'static str), CannotBeAnArg(&'static str), NoRequirement, } fn get_requirement_for_arg_direction(type_: &ast::Type) -> RequirementForArgDirection { match type_.kind { ast::TypeKind::Primitive => { RequirementForArgDirection::CanOnlyBeInOrUnspecified("primitives") } ast::TypeKind::Void => RequirementForArgDirection::CanOnlyBeInOrUnspecified("void"), ast::TypeKind::Array => RequirementForArgDirection::DirectionRequired("arrays"), ast::TypeKind::Map | ast::TypeKind::List => { RequirementForArgDirection::DirectionRequired("maps") } ast::TypeKind::String => RequirementForArgDirection::CanOnlyBeInOrUnspecified("strings"), ast::TypeKind::CharSequence => { RequirementForArgDirection::CanOnlyBeInOrUnspecified("CharSequence") } ast::TypeKind::ParcelableHolder => { RequirementForArgDirection::CannotBeAnArg("ParcelableHolder") } ast::TypeKind::IBinder => todo!(), ast::TypeKind::FileDescriptor => todo!(), ast::TypeKind::ParcelFileDescriptor => { RequirementForArgDirection::CanOnlyBeInOrInOut("ParcelFileDescriptor") } // because it is not default-constructible ast::TypeKind::Resolved(_, Some(ast::ItemKind::Parcelable)) => { RequirementForArgDirection::DirectionRequired("parcelables") } ast::TypeKind::Resolved(_, Some(ast::ItemKind::Interface)) => { RequirementForArgDirection::CanOnlyBeInOrUnspecified("interfaces") } ast::TypeKind::Resolved(_, Some(ast::ItemKind::Enum)) => { RequirementForArgDirection::CanOnlyBeInOrUnspecified("enums") } ast::TypeKind::Resolved(_, None) => RequirementForArgDirection::NoRequirement, ast::TypeKind::Unresolved => RequirementForArgDirection::NoRequirement, } } // Can only have one dimensional arrays // "Binder" type cannot be an array (with interface element...) // TODO: not allowed for ParcelableHolder, allowed for IBinder, ... fn check_array_element(type_: &ast::Type, diagnostics: &mut Vec<Diagnostic>) { let ok = match type_.kind { // Not OK (custom diagnostic and return) ast::TypeKind::Array => { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: String::from("Unsupported multi-dimensional array"), context_message: Some("unsupported array".to_owned()), range: type_.symbol_range.clone(), hint: Some("must be one-dimensional".to_owned()), related_infos: Vec::new(), }); return; } ast::TypeKind::Primitive => true, ast::TypeKind::String => true, ast::TypeKind::CharSequence => false, ast::TypeKind::List => false, ast::TypeKind::Map => false, ast::TypeKind::Void => false, ast::TypeKind::ParcelableHolder => false, ast::TypeKind::IBinder => true, ast::TypeKind::FileDescriptor => true, ast::TypeKind::ParcelFileDescriptor => true, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Parcelable)) => true, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Interface)) => false, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Enum)) => true, // OK: enum is backed by a primitive ast::TypeKind::Resolved(_, None) => true, // we don't know ast::TypeKind::Unresolved => true, // we don't know }; if !ok { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid array element `{}`", type_.name), context_message: Some("invalid parameter".to_owned()), range: type_.symbol_range.clone(), hint: Some( "must be a primitive, an enum, a String, a parcelable or a IBinder".to_owned(), ), related_infos: Vec::new(), }); } } // List<T> supports parcelable/union, String, IBinder, and ParcelFileDescriptor fn check_list_element(type_: &ast::Type, diagnostics: &mut Vec<Diagnostic>) { let ok = match type_.kind { ast::TypeKind::Array => false, ast::TypeKind::List => false, ast::TypeKind::Map => false, ast::TypeKind::Primitive => false, ast::TypeKind::String => true, ast::TypeKind::CharSequence => false, ast::TypeKind::Void => false, ast::TypeKind::ParcelableHolder => false, ast::TypeKind::IBinder => true, ast::TypeKind::FileDescriptor => false, ast::TypeKind::ParcelFileDescriptor => true, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Parcelable)) => true, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Interface)) => false, // "Binder" type cannot be an array ast::TypeKind::Resolved(_, Some(ast::ItemKind::Enum)) => false, // OK: enum is backed by a primitive ast::TypeKind::Resolved(_, None) => true, // we don't know ast::TypeKind::Unresolved => true, // we don't know }; if !ok { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid list element `{}`", type_.name), context_message: Some("invalid element".to_owned()), range: type_.symbol_range.clone(), hint: Some( "must be a parcelable/enum, a String, a IBinder or a ParcelFileDescriptor" .to_owned(), ), related_infos: Vec::new(), }); } } // The type of key in map must be String fn check_map_key(type_: &ast::Type, diagnostics: &mut Vec<Diagnostic>) { if !matches!(type_.kind, ast::TypeKind::String if type_.name == "String") { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid map key `{}`", type_.name), context_message: Some("invalid map key".to_owned()), range: type_.symbol_range.clone(), hint: Some( "must be a parcelable/enum, a String, a IBinder or a ParcelFileDescriptor" .to_owned(), ), related_infos: Vec::new(), }); } } // A generic type cannot have any primitive type parameters fn check_map_value(type_: &ast::Type, diagnostics: &mut Vec<Diagnostic>) { let ok = match type_.kind { ast::TypeKind::Array => true, ast::TypeKind::List => true, ast::TypeKind::Map => true, ast::TypeKind::String => true, ast::TypeKind::CharSequence => true, ast::TypeKind::Primitive => false, ast::TypeKind::Void => false, ast::TypeKind::ParcelableHolder => true, ast::TypeKind::IBinder => true, ast::TypeKind::FileDescriptor => true, ast::TypeKind::ParcelFileDescriptor => true, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Parcelable)) => true, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Interface)) => true, ast::TypeKind::Resolved(_, Some(ast::ItemKind::Enum)) => false, ast::TypeKind::Resolved(_, None) => true, // we don't know ast::TypeKind::Unresolved => true, // we don't know }; if !ok { diagnostics.push(Diagnostic { kind: DiagnosticKind::Error, message: format!("Invalid map value `{}`", type_.name), context_message: Some("invalid map value".to_owned()), range: type_.symbol_range.clone(), hint: Some("cannot not be a primitive".to_owned()), related_infos: Vec::new(), }); } } #[cfg(test)] mod tests { use self::utils::create_method_with_name_and_id; use super::*; use crate::ast; #[test] fn test_check_imports() { let imports = Vec::from([ utils::create_import("TestParcelable", 1), utils::create_import("TestParcelable", 2), utils::create_import("TestInterface", 3), utils::create_import("UnusedEnum", 4), utils::create_import("NonExisting", 5), ]); let resolved = HashSet::from([ "test.path.TestParcelable".into(), "test.path.TestInterface".into(), ]); let defined = HashMap::from([ ("test.path.TestParcelable".into(), ast::ItemKind::Parcelable), ("test.path.TestInterface".into(), ast::ItemKind::Interface), ("test.path.UnusedEnum".into(), ast::ItemKind::Enum), ]); let mut diagnostics = Vec::new(); check_imports(&imports, &resolved, &defined, &mut diagnostics); diagnostics.sort_by_key(|d| d.range.start.line_col.0); assert_eq!(diagnostics.len(), 3); let d = &diagnostics[0]; assert_eq!(d.kind, DiagnosticKind::Error); assert!(d.message.contains("Duplicated import")); assert_eq!(d.range.start.line_col.0, 2); let d = &diagnostics[1]; assert_eq!(d.kind, DiagnosticKind::Warning); assert!(d.message.contains("Unused import `UnusedEnum`")); assert_eq!(d.range.start.line_col.0, 4); let d = &diagnostics[2]; assert_eq!(d.kind, DiagnosticKind::Error); assert!(d.message.contains("Unresolved import `NonExisting`")); assert_eq!(d.range.start.line_col.0, 5); } #[test] fn test_check_declared_parcelables() { let declared_parcelables = Vec::from([ utils::create_import("DeclaredParcelable1", 2), utils::create_import("DeclaredParcelable1", 3), utils::create_import("DeclaredParcelable2", 4), utils::create_import("UnusedParcelable", 5), utils::create_import("AlreadyImported", 6), ]); let import = ast::Import { path: "test.other.path".into(), name: "AlreadyImported".into(), symbol_range: utils::create_range(1), full_range: utils::create_range(1), }; let import_map = HashMap::from([(import.get_qualified_name(), &import)]); let resolved = HashSet::from([ "test.path.DeclaredParcelable1".into(), "test.path.DeclaredParcelable2".into(), ]); let mut diagnostics = Vec::new(); check_declared_parcelables( &declared_parcelables, &import_map, &resolved, &mut diagnostics, ); diagnostics.sort_by_key(|d| d.range.start.line_col.0); assert_eq!(diagnostics.len(), 5); let d = &diagnostics[0]; assert_eq!(d.kind, DiagnosticKind::Warning); assert_eq!(d.range.start.line_col.0, 2); let d = &diagnostics[1]; assert_eq!(d.kind, DiagnosticKind::Error); assert!(d.message.contains("Multiple parcelable declarations")); assert_eq!(d.range.start.line_col.0, 3); let d = &diagnostics[2]; assert_eq!(d.kind, DiagnosticKind::Warning); assert_eq!(d.range.start.line_col.0, 4); let d = &diagnostics[3]; assert_eq!(d.kind, DiagnosticKind::Warning); assert!(d .message .contains("Unused declared parcelable `UnusedParcelable`")); assert_eq!(d.range.start.line_col.0, 5); let d = &diagnostics[4]; assert_eq!(d.kind, DiagnosticKind::Error); assert!(d.message.contains("conflicts")); assert_eq!(d.range.start.line_col.0, 6); } #[test] fn test_check_type() { // Valid arrays for t in [ utils::create_int(0), utils::create_string(0), utils::create_android_builtin(ast::TypeKind::IBinder, 0), utils::create_android_builtin(ast::TypeKind::FileDescriptor, 0), utils::create_android_builtin(ast::TypeKind::ParcelFileDescriptor, 0), utils::create_custom_type("test.TestParcelable", ast::ItemKind::Parcelable, 0), utils::create_custom_type("test.TestEnum", ast::ItemKind::Enum, 0), ] .into_iter() { let array = utils::create_array(t, 0); let mut diagnostics = Vec::new(); check_type(&array, &mut diagnostics); assert_eq!(diagnostics.len(), 0); } // Multi-dimensional array let mut diagnostics = Vec::new(); let array = utils::create_array(utils::create_array(utils::create_int(0), 0), 0); check_type(&array, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert!(diagnostics[0] .message .contains("Unsupported multi-dimensional array")); // Invalid arrays for t in [ utils::create_android_builtin(ast::TypeKind::ParcelableHolder, 0), utils::create_list(None, 0), utils::create_map(None, 0), utils::create_custom_type("test.TestInterface", ast::ItemKind::Interface, 0), utils::create_char_sequence(0), utils::create_void(0), ] .into_iter() { let array = utils::create_array(t, 0); let mut diagnostics = Vec::new(); check_type(&array, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert!(diagnostics[0].message.contains("Invalid array")); } // Valid list for t in [ utils::create_string(0), utils::create_android_builtin(ast::TypeKind::IBinder, 0), utils::create_android_builtin(ast::TypeKind::ParcelFileDescriptor, 0), utils::create_custom_type("test.TestParcelable", ast::ItemKind::Parcelable, 0), ] .into_iter() { let list = utils::create_list(Some(t), 0); let mut diagnostics = Vec::new(); check_type(&list, &mut diagnostics); assert_eq!(diagnostics.len(), 0); } // Non-generic list -> warning let mut diagnostics = Vec::new(); let list = utils::create_list(None, 105); check_type(&list, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert_eq!(diagnostics[0].kind, DiagnosticKind::Warning); assert_eq!(diagnostics[0].range.start.line_col.0, 105); assert_eq!(diagnostics[0].range.end.line_col.0, 105); assert!(diagnostics[0].message.contains("not recommended")); // Invalid lists for t in [ utils::create_void(0), utils::create_char_sequence(0), utils::create_android_builtin(ast::TypeKind::ParcelableHolder, 0), utils::create_android_builtin(ast::TypeKind::FileDescriptor, 0), utils::create_array(utils::create_int(0), 0), utils::create_list(None, 0), utils::create_map(None, 0), utils::create_custom_type("test.TestInterface", ast::ItemKind::Interface, 0), utils::create_custom_type("test.TestEnum", ast::ItemKind::Enum, 0), ] .into_iter() { let list = utils::create_list(Some(t), 0); let mut diagnostics = Vec::new(); check_type(&list, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert!(diagnostics[0].message.contains("Invalid list")); } // Valid map for vt in [ utils::create_string(0), utils::create_android_builtin(ast::TypeKind::ParcelableHolder, 0), utils::create_android_builtin(ast::TypeKind::IBinder, 0), utils::create_android_builtin(ast::TypeKind::FileDescriptor, 0), utils::create_android_builtin(ast::TypeKind::ParcelFileDescriptor, 0), utils::create_array(utils::create_int(0), 0), utils::create_list(None, 0), utils::create_map(None, 0), utils::create_custom_type("test.TestParcelable", ast::ItemKind::Parcelable, 0), utils::create_custom_type("test.TestInterface", ast::ItemKind::Interface, 0), ] .into_iter() { let map = utils::create_map(Some((utils::create_string(0), vt)), 0); let mut diagnostics = Vec::new(); check_type(&map, &mut diagnostics); assert_eq!(diagnostics.len(), 0); } // Non-generic map -> warning let mut diagnostics = Vec::new(); let map = utils::create_map(None, 205); check_type(&map, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert_eq!(diagnostics[0].kind, DiagnosticKind::Warning); assert_eq!(diagnostics[0].range.start.line_col.0, 205); assert_eq!(diagnostics[0].range.end.line_col.0, 205); assert!(diagnostics[0].message.contains("not recommended")); // Invalid map keys for kt in [ utils::create_void(0), utils::create_char_sequence(0), utils::create_array(utils::create_int(0), 0), utils::create_list(None, 0), utils::create_map(None, 0), utils::create_custom_type("test.TestParcelable", ast::ItemKind::Parcelable, 0), utils::create_custom_type("test.TestInterface", ast::ItemKind::Interface, 0), utils::create_custom_type("test.TestEnum", ast::ItemKind::Enum, 0), ] .into_iter() { let map = utils::create_map(Some((kt, utils::create_string(0))), 0); let mut diagnostics = Vec::new(); check_type(&map, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert!(diagnostics[0].message.contains("Invalid map")); } // Invalid map values for vt in [ utils::create_int(0), utils::create_void(0), utils::create_custom_type("test.TestEnum", ast::ItemKind::Enum, 0), ] .into_iter() { let map = utils::create_map(Some((utils::create_string(0), vt)), 0); let mut diagnostics = Vec::new(); check_type(&map, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert!(diagnostics[0].message.contains("Invalid map")); } } #[test] fn test_set_up_oneway() { let blocking_method = utils::create_method_with_name_and_id("blocking_method", None, 20); let mut oneway_method = utils::create_method_with_name_and_id("oneway_method", None, 10); oneway_method.oneway = true; let mut interface = ast::Interface { oneway: false, name: "testMethod".into(), elements: [blocking_method, oneway_method] .into_iter() .map(ast::InterfaceElement::Method) .collect(), annotations: Vec::new(), doc: None, full_range: utils::create_range(5), symbol_range: utils::create_range(5), }; // "normal" interface -> no change, no diagnostic assert!(!interface.oneway); let mut diagnostics = Vec::new(); set_up_oneway_interface(&mut interface, &mut diagnostics); assert!(!interface.elements[0].as_method().unwrap().oneway,); assert!(interface.elements[1].as_method().unwrap().oneway,); assert_eq!(diagnostics.len(), 0); interface.oneway = true; // oneway interface -> blocking method will be oneway, oneway method will cause a warning let mut diagnostics = Vec::new(); set_up_oneway_interface(&mut interface, &mut diagnostics); assert!(interface.elements[0].as_method().unwrap().oneway); assert!(interface.elements[1].as_method().unwrap().oneway); assert_eq!(diagnostics.len(), 1); assert_eq!(diagnostics[0].kind, DiagnosticKind::Warning); assert!(diagnostics[0] .message .contains("does not need to be marked as oneway")); assert_eq!(diagnostics[0].related_infos.len(), 1); assert_eq!(diagnostics[0].related_infos[0].range.start.line_col.0, 5); } #[test] fn test_check_method() { // Non-async method with return value -> ok let void_method = ast::Method { oneway: false, name: "test".into(), return_type: utils::create_void(0), args: Vec::new(), annotations: Vec::new(), value: None, doc: None, symbol_range: utils::create_range(0), full_range: utils::create_range(0), value_range: utils::create_range(0), oneway_range: utils::create_range(0), }; let mut diagnostics = Vec::new(); check_method(&void_method, &mut diagnostics); assert_eq!(diagnostics.len(), 0); // Oneway method returning void -> ok let mut oneway_void_method = void_method.clone(); oneway_void_method.oneway = true; let mut diagnostics = Vec::new(); check_method(&oneway_void_method, &mut diagnostics); assert_eq!(diagnostics.len(), 0); // Async method with return value -> error let mut oneway_int_method = oneway_void_method.clone(); oneway_int_method.return_type = utils::create_int(0); let mut diagnostics = Vec::new(); check_method(&oneway_int_method, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert!(diagnostics[0] .message .contains("Invalid return type of async")); } #[test] fn test_check_method_ids() { let methods = Vec::from([ create_method_with_name_and_id("method0", None, 10), create_method_with_name_and_id("method1", Some(1), 20), create_method_with_name_and_id("method2", Some(2), 30), create_method_with_name_and_id("method2", Some(3), 40), create_method_with_name_and_id("method3", Some(1), 50), ]); let ast = ast::Aidl { package: ast::Package { name: "test.package".into(), symbol_range: utils::create_range(0), full_range: utils::create_range(0), }, imports: Vec::new(), declared_parcelables: Vec::new(), item: ast::Item::Interface(ast::Interface { oneway: false, name: "testMethod".into(), elements: methods .into_iter() .map(ast::InterfaceElement::Method) .collect(), annotations: Vec::new(), doc: None, full_range: utils::create_range(0), symbol_range: utils::create_range(0), }), }; let mut diagnostics = Vec::new(); check_methods(&ast, &mut diagnostics); assert_eq!(diagnostics.len(), 3); // Mixed methods with/without id assert_eq!(diagnostics[0].kind, DiagnosticKind::Error); assert!(diagnostics[0].message.contains("Mixed usage of method id")); assert_eq!(diagnostics[0].range.start.line_col.0, 21); // Duplicated method name assert_eq!(diagnostics[1].kind, DiagnosticKind::Error); assert!(diagnostics[1].message.contains("Duplicated method name")); assert_eq!(diagnostics[1].range.start.line_col.0, 40); // Duplicated method id assert_eq!(diagnostics[2].kind, DiagnosticKind::Error); assert!(diagnostics[2].message.contains("Duplicated method id")); assert_eq!(diagnostics[2].range.start.line_col.0, 51); } #[test] fn test_check_method_args() { let base_method = ast::Method { oneway: false, name: "testMethod".into(), return_type: utils::create_void(0), args: Vec::new(), value: None, annotations: Vec::new(), doc: None, symbol_range: utils::create_range(0), full_range: utils::create_range(1), value_range: utils::create_range(0), oneway_range: utils::create_range(0), }; // Types which are not allowed to be used for args for t in [utils::create_android_builtin( ast::TypeKind::ParcelableHolder, 0, )] .into_iter() { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.args = Vec::from([utils::create_arg( t, ast::Direction::In(utils::create_range(0)), )]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), 1); assert!(diagnostics[0].message.contains("Invalid argument")); } // Primitives, String and Interfaces can only be in or unspecified for t in [ utils::create_int(0), utils::create_string(0), utils::create_char_sequence(0), utils::create_custom_type("test.TestInterface", ast::ItemKind::Interface, 0), utils::create_custom_type("test.TestEnum", ast::ItemKind::Enum, 0), ] .into_iter() { // Unspecified or In => OK { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.args = Vec::from([ utils::create_arg(t.clone(), ast::Direction::Unspecified), utils::create_arg(t.clone(), ast::Direction::In(utils::create_range(0))), ]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), 0); } // Out or InOut => ERROR { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.args = Vec::from([ utils::create_arg(t.clone(), ast::Direction::Out(utils::create_range(0))), utils::create_arg(t, ast::Direction::InOut(utils::create_range(0))), ]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), method.args.len()); for d in diagnostics { assert_eq!(d.kind, DiagnosticKind::Error); } } } // ParcelFileDescriptor cannot be out for t in [utils::create_android_builtin( ast::TypeKind::ParcelFileDescriptor, 0, )] .into_iter() { // In or InOut => OK { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.args = Vec::from([ utils::create_arg(t.clone(), ast::Direction::In(utils::create_range(0))), utils::create_arg(t.clone(), ast::Direction::InOut(utils::create_range(0))), ]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), 0); } // Unspecified or Out => ERROR { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.args = Vec::from([ utils::create_arg(t.clone(), ast::Direction::Unspecified), utils::create_arg(t, ast::Direction::Out(utils::create_range(0))), ]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), method.args.len()); for d in diagnostics { assert_eq!(d.kind, DiagnosticKind::Error); } } } // Arrays, maps and parcelables require direction for t in [ utils::create_array(utils::create_int(0), 0), utils::create_list(None, 0), utils::create_map(None, 0), utils::create_custom_type("test.TestParcelable", ast::ItemKind::Parcelable, 0), ] .into_iter() { // In, Out or InOut => OK { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.args = Vec::from([ utils::create_arg(t.clone(), ast::Direction::In(utils::create_range(0))), utils::create_arg(t.clone(), ast::Direction::Out(utils::create_range(0))), utils::create_arg(t.clone(), ast::Direction::InOut(utils::create_range(0))), ]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), 0); } // Unspecified => ERROR { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.args = Vec::from([utils::create_arg(t, ast::Direction::Unspecified)]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), method.args.len()); for d in diagnostics { assert_eq!(d.kind, DiagnosticKind::Error); } } } // Arguments of oneway methods cannot be out or inout for t in [ utils::create_array(utils::create_int(0), 0), utils::create_list(None, 0), utils::create_map(None, 0), utils::create_custom_type("test.TestParcelable", ast::ItemKind::Parcelable, 0), ] .into_iter() { // async + In => OK { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.oneway = true; method.args = Vec::from([utils::create_arg( t.clone(), ast::Direction::In(utils::create_range(0)), )]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), 0); } // async + Out, InOut => ERROR { let mut diagnostics = Vec::new(); let mut method = base_method.clone(); method.oneway = true; method.args = Vec::from([ utils::create_arg(t.clone(), ast::Direction::Out(utils::create_range(0))), utils::create_arg(t, ast::Direction::InOut(utils::create_range(0))), ]); check_method_args(&method, &mut diagnostics); assert_eq!(diagnostics.len(), method.args.len()); for d in diagnostics { assert_eq!(d.kind, DiagnosticKind::Error); } } } } // Test utils // --- mod utils { use crate::ast; pub fn create_range(line: usize) -> ast::Range { ast::Range { start: ast::Position { offset: 0, line_col: (line, 10), }, end: ast::Position { offset: 0, line_col: (line, 20), }, } } pub fn create_import(name: &str, line: usize) -> ast::Import { ast::Import { path: "test.path".into(), name: name.to_owned(), symbol_range: create_range(line), full_range: create_range(line), } } pub fn create_int(line: usize) -> ast::Type { create_simple_type("int", ast::TypeKind::Primitive, line) } pub fn create_void(line: usize) -> ast::Type { create_simple_type("void", ast::TypeKind::Void, line) } pub fn create_string(line: usize) -> ast::Type { create_simple_type("String", ast::TypeKind::String, line) } pub fn create_char_sequence(line: usize) -> ast::Type { create_simple_type("CharSequence", ast::TypeKind::CharSequence, line) } pub fn create_android_builtin(kind: ast::TypeKind, line: usize) -> ast::Type { let name = match kind { ast::TypeKind::ParcelableHolder => "ParcelableHolder", ast::TypeKind::IBinder => "IBinder", ast::TypeKind::FileDescriptor => "FileDescriptor", ast::TypeKind::ParcelFileDescriptor => "ParcelFileDescriptor", _ => unreachable!(), }; create_simple_type(name, kind, line) } fn create_simple_type(name: &'static str, kind: ast::TypeKind, line: usize) -> ast::Type { ast::Type { name: name.into(), kind, generic_types: Vec::new(), symbol_range: create_range(line), full_range: create_range(line), } } pub fn create_array(generic_type: ast::Type, line: usize) -> ast::Type { ast::Type { name: "Array".into(), kind: ast::TypeKind::Array, generic_types: Vec::from([generic_type]), symbol_range: create_range(line), full_range: create_range(line), } } pub fn create_list(generic_type: Option<ast::Type>, line: usize) -> ast::Type { ast::Type { name: "List".into(), kind: ast::TypeKind::List, generic_types: generic_type.map(|t| [t].into()).unwrap_or_default(), symbol_range: create_range(line), full_range: create_range(line), } } pub fn create_map( key_value_types: Option<(ast::Type, ast::Type)>, line: usize, ) -> ast::Type { ast::Type { name: "Map".into(), kind: ast::TypeKind::Map, generic_types: key_value_types .map(|(k, v)| Vec::from([k, v])) .unwrap_or_default(), symbol_range: create_range(line), full_range: create_range(line), } } pub fn create_custom_type(path: &str, item_kind: ast::ItemKind, line: usize) -> ast::Type { ast::Type { name: "TestCustomType".into(), kind: ast::TypeKind::Resolved(path.into(), Some(item_kind)), generic_types: Vec::new(), symbol_range: create_range(line), full_range: create_range(line), } } pub fn create_method_with_name_and_id( name: &str, id: Option<u32>, line: usize, ) -> ast::Method { ast::Method { oneway: false, name: name.into(), return_type: create_int(0), args: Vec::new(), annotations: Vec::new(), value: id, doc: None, symbol_range: create_range(line), full_range: create_range(line), value_range: create_range(line + 1), oneway_range: create_range(line + 2), } } pub fn create_arg(arg_type: ast::Type, direction: ast::Direction) -> ast::Arg { ast::Arg { direction, name: None, arg_type, annotations: Vec::new(), doc: None, symbol_range: create_range(0), full_range: create_range(0), } } } }
Home environment of upper primary students The purpose of the study was to examine the home environment of upper primary students. The study was carried out on a sample of 400 upper primary students studying in class 8 in various schools of Kanyakumari district. Normative Survey method was adopted for the study. Home Environment Scale developed by Akhtar and Saxena was used to collect the data. Percentage and t test were used to analyze the data. The result of the study revealed that, the upper primary students have moderate level of home environment. Moreover, they differ significantly in their home environment with respect to gender and locality of residence. No significant difference was noted in the medium of instruction.
Source: KHN analysis of Nursing Home Compare data from the Centers for Medicare & Medicaid Services. For this story, KHN analyzed data on nursing home inspection reports and staffing kept by the Centers for Medicare & Medicaid Services (CMS). Its Nursing Home Compare database presents metrics for assessing the quality of care at nursing homes that are certified by Medicare and Medicaid. Our analysis included citations that indicate increased risk for infections which are common causes of sepsis. We looked at deficiencies in care related to Bedsores, catheters, Feeding tubes and the home's required infection prevention and control program. We excluded citations with no or minimal potential for harm, such as paperwork violations and other minor citations. KHN also analyzed staffing measures in Nursing Home Compare that are based on payroll records for the latest quarter of 2018, using the adjusted average hours of care given to each resident by registered nurses (RNs), licensed practical nurses (LPNs) and certified nursing assistants (CNAs). These hours are adjusted by CMS according to the relative need of the residents in each home, making them fair for comparison among homes that may have residents with different levels of need. Homes that have not submitted payroll data were excluded from the analysis. For overall numbers of sepsis deaths in hospitals and costs to Medicare, KHN worked with Definitive Healthcare, a private health care data firm. We provided ICD-9 and -10 codes for septicemia based on HCUP Clinical Classifications Software, excluding codes specifically for newborns. Definitive Healthcare analyzed claims sourced from CMS' Inpatient LDS and Skilled Nursing Facility LDS Standard Analytic Files (SAF); the analysis was modeled after a 2013 report by the Department of Health and Human Services' Office of the Inspector General. Definitive Healthcare analyzed the annual data files for calendar years 2012 through 2016 as well as the 2017 quarterly data files for Q1 through Q3. The analysis looked at hospitalizations for patients who had been discharged from a Skilled Nursing Facility within one day of the hospitalization. The analysis identified cases of septicemia in both primary and secondary diagnoses, and cases where the patient died in the hospital. The analysis excluded patients of hospital-based swing-bed units. Reporters used Courthouse News, a legal reporting service, to analyze negligence lawsuits across the country involving injuries related to sepsis and other infections in nursing homes. Note: *Staffing is adjusted by CMS for better comparison; adjustments are based on the level of residents' needs.
<reponame>jainsakshi2395/linux /* SPDX-License-Identifier: ISC */ /* Copyright (C) 2020 MediaTek Inc. */ #ifndef __MT7921_EEPROM_H #define __MT7921_EEPROM_H #include "mt7921.h" enum mt7921_eeprom_field { MT_EE_CHIP_ID = 0x000, MT_EE_VERSION = 0x002, MT_EE_MAC_ADDR = 0x004, MT_EE_WIFI_CONF = 0x07c, __MT_EE_MAX = 0x3bf }; #define MT_EE_WIFI_CONF_TX_MASK BIT(0) #define MT_EE_WIFI_CONF_BAND_SEL GENMASK(3, 2) enum mt7921_eeprom_band { MT_EE_NA, MT_EE_5GHZ, MT_EE_2GHZ, MT_EE_DUAL_BAND, }; #endif
This invention is directed to implements used in various industries and more particularly a row planter assembly and cutter assembly used with an automatic control system. Row planter assemblies are well known in the art. Existing planter assemblies include a seed meter delivering seed through a drop tube into a furrow opened by a dual disc opener. While useful, problems still exist. Current planters are inconsistent in seed spacing and accuracy which affects enhanced yield performance and productivity. Also, not only is the spacing between rows limited, but due to the weight of the row planter, undesirable soil compaction occurs. Therefore, a need exists in the art for a device that addresses these deficiencies. An objective of the present invention is to provide a row planter assembly that increases seed placement accuracy. Another objective of the present invention is to provide a row planter assembly that reduces soil compaction. A still further objective of the present invention is to provide a row planter assembly configured to provide more narrow rows. These and other objectives will be apparent to those skilled in the art based upon the following written description, drawings and claims.
Comparative analysis in terms of computational cost for different discrimination algorithms in implantable defibriilators Implantable defibrillators (ICDs) use very low computational cost criteria (rate, stability and onset) offering good sensitivity for arrhythmia detection. Although, the specificity of these combined criteria decreases in difficult arrhythmia discrimination as in case of discrimination between ventricular tachycardia (VT) and supraventricular tachycardia (SVT). Several morphological published algorithms enhance arrhythmia discrimination but most algorithms are developed in personal computers and cannot be used in ICDs because of computational cost requirements compared with limited ICD capabilities. A general method to determine the possibility of ICD implementation for a discrimination algorithm has been proposed.
#ifndef SNAPPIT_H #define SNAPPIT_H #include <QWidget> #include "ui_snappit.h" #include "imageview.h" #include "screenview.h" #include <QSystemTrayIcon> #include "QMenu" class snappit : public QWidget { Q_OBJECT public: snappit(QWidget *parent = 0); ~snappit(); public: void openImage(); void screenShotCut(); void trayMenuTrigged(QAction* action); void trayActivated(QSystemTrayIcon::ActivationReason reason); void switchLanguage(const QString &text); private: void languageTranslate(); protected: void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE; void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; private: Ui::snappit ui; std::vector<ImageView *> _arr_imgView; QString _file_path; QSystemTrayIcon *m_tray; QMenu *m_trayMenu; QAction *m_prefer; QAction *m_quit; QTranslator *m_translator; }; #endif // SNAPPIT_H
// // CSW.cpp // Clock Signal // // Created by <NAME> on 10/07/2017. // Copyright 2017 <NAME>. All rights reserved. // #include "CSW.hpp" #include "../../FileHolder.hpp" #include <cassert> using namespace Storage::Tape; CSW::CSW(const std::string &file_name) : source_data_pointer_(0) { Storage::FileHolder file(file_name); if(file.stats().st_size < 0x20) throw ErrorNotCSW; // Check signature. if(!file.check_signature("Compressed Square Wave")) { throw ErrorNotCSW; } // Check terminating byte. if(file.get8() != 0x1a) throw ErrorNotCSW; // Get version file number. uint8_t major_version = file.get8(); uint8_t minor_version = file.get8(); // Reject if this is an unknown version. if(major_version > 2 || !major_version || minor_version > 1) throw ErrorNotCSW; // The header now diverges based on version. uint32_t number_of_waves = 0; if(major_version == 1) { pulse_.length.clock_rate = file.get16le(); if(file.get8() != 1) throw ErrorNotCSW; compression_type_ = CompressionType::RLE; pulse_.type = (file.get8() & 1) ? Pulse::High : Pulse::Low; file.seek(0x20, SEEK_SET); } else { pulse_.length.clock_rate = file.get32le(); number_of_waves = file.get32le(); switch(file.get8()) { case 1: compression_type_ = CompressionType::RLE; break; case 2: compression_type_ = CompressionType::ZRLE; break; default: throw ErrorNotCSW; } pulse_.type = (file.get8() & 1) ? Pulse::High : Pulse::Low; uint8_t extension_length = file.get8(); if(file.stats().st_size < 0x34 + extension_length) throw ErrorNotCSW; file.seek(0x34 + extension_length, SEEK_SET); } // Grab all data remaining in the file. std::vector<uint8_t> file_data; std::size_t remaining_data = size_t(file.stats().st_size) - size_t(file.tell()); file_data.resize(remaining_data); file.read(file_data.data(), remaining_data); if(compression_type_ == CompressionType::ZRLE) { // The only clue given by CSW as to the output size in bytes is that there will be // number_of_waves waves. Waves are usually one byte, but may be five. So this code // is pessimistic. source_data_.resize(size_t(number_of_waves) * 5); // uncompress will tell how many compressed bytes there actually were, so use its // modification of output_length to throw away all the memory that isn't actually // needed. uLongf output_length = uLongf(number_of_waves * 5); uncompress(source_data_.data(), &output_length, file_data.data(), file_data.size()); source_data_.resize(std::size_t(output_length)); } else { source_data_ = std::move(file_data); } invert_pulse(); } CSW::CSW(const std::vector<uint8_t> &&data, CompressionType compression_type, bool initial_level, uint32_t sampling_rate) : compression_type_(compression_type) { pulse_.length.clock_rate = sampling_rate; pulse_.type = initial_level ? Pulse::High : Pulse::Low; source_data_ = std::move(data); } uint8_t CSW::get_next_byte() { if(source_data_pointer_ == source_data_.size()) return 0xff; uint8_t result = source_data_[source_data_pointer_]; source_data_pointer_++; return result; } uint32_t CSW::get_next_int32le() { if(source_data_pointer_ > source_data_.size() - 4) return 0xffff; uint32_t result = uint32_t( (source_data_[source_data_pointer_ + 0] << 0) | (source_data_[source_data_pointer_ + 1] << 8) | (source_data_[source_data_pointer_ + 2] << 16) | (source_data_[source_data_pointer_ + 3] << 24)); source_data_pointer_ += 4; return result; } void CSW::invert_pulse() { pulse_.type = (pulse_.type == Pulse::High) ? Pulse::Low : Pulse::High; } bool CSW::is_at_end() { return source_data_pointer_ == source_data_.size(); } void CSW::virtual_reset() { source_data_pointer_ = 0; } Tape::Pulse CSW::virtual_get_next_pulse() { invert_pulse(); pulse_.length.length = get_next_byte(); if(!pulse_.length.length) pulse_.length.length = get_next_int32le(); return pulse_; }
1. Field of the Invention The present invention relates to a digital image processing method, and more particularly to a method of correcting color of a false-color pixel in a digital image. 2. Related Art Color recognition with human eye is based on a principle that the human eye has three different sensing units for light rays, and different sensing units have different response curves for lights at different wave bands, and the color sensation is achieved through the composite effect of the brain. Generally, we can commonly understand the color decomposition and composite through the RGB three primary color concept. The working principle of a photosensitive element for a digital camera is not completely the same as the response of the human eye for the RGB lights. The response of the photosensitive element for the spectrum is slightly different from the response of human eye for the spectrum on each component of the RGB light, so definitely, the correction is required. Not only the crossing effect, but also the response strength for each color component must be corrected. The common method is to perform color correction once through a color correction matrix (briefly referred to as CCM below). The CCM processing flow can be obtained with reference to FIG. 1. Firstly, a group of CCM is set (Step S110). The CCM may be a group of 3*3 pixel matrix or 4*3 pixel matrix, in which the size of the pixel matrix is determined according to a set processing algorithm. The CCM is respectively used in the digital image, such that the CCM is respectively and non-overlappingly used in the digital image (Step S120). Referring to Equation 1, it is a CCM equation. [ R ′ G ′ B ′ ] = [ CCM 11 CCM 12 CCM 13 CCM 21 CCM 22 CCM 23 CCM 31 CCM 32 CCM 33 ] * [ R G B ] Equation ⁢ ⁢ 1 R is a red pixel, G is a green pixel, and B is a blue pixel, CCMmn are respectively color correcting parameters, in which m is at the position of the row, and n is at the position of the column, R′ is the red pixel after color correction, G′ is the green pixel after color correction, and B′ is the blue pixel after color correction. Referring to FIGS. 2a and 2b, they are respectively schematic views of a digital image after being processed by CCM. In a raw image 200 in FIG. 2a, each small block represents a pixel 220. A CCM 210 is a dashed-line block, which is assumed that it has a 3*3 pixel size. In FIG. 2b, as for the raw image 200, each pixel 220 is further divided into three pixels with different colors, namely, a red pixel 221, a green pixel 222, and a blue pixel 223. Finally, according to the above operation results, FIG. 2c is a schematic view of a pixel value after the color correction in the conventional art. In a processed image 300, an oblique-line block is a false-color pixel 230. However, after the color correction is performed on the digital image, although the color saturation of the processed image 300 is improved, color spots or color blocks that do not exist in the original actual scene may be generated in the detailed part of the image. In the conventional art, the false color is eliminated through a Gaussian filter, low-pass filer or other methods. However, in such filter methods, the eliminating motion is performed on all the pixels of the digital image, and although the false color can be eliminated, the color bias of other pixels may be caused accordingly.
THE RESULTS OF THE FIRST COMPETITION IN VOLLEYBALL AMONG THE STUDENTS OF SSUGT ELECTIVE COURSES According to the Program for physical education of SSUGT students can choose classes in Physical Education in the form of elective courses, including volleyball. To supplement practical lessons of testing theoretical knowledge, the plan of research work included an Olympiad in volleyball for students who attend elective courses in this sport. The article presents statistical data on the results of the Olympiad, offers suggestions and recommendations based on the obtained results.
How important can the presence/absence of macrophytes be in determining phytoplankton strategies in two tropical shallow reservoirs with different trophic status? This study aimed at comparing phytoplankton taxonomic classes and morpho-functional attributes in two shallow tropical reservoirs with different nutrient levels and representing extremes of the alternative stable states theory. The reservoirs, locally called Ninfeias Pond (23°38'18.95"S; 46°37'16.3"W) and Garcas Pond (23°38'40.6"S; 46°37'28.0"W), are located in the city of Sao Paulo, southeastern Brazil. Ninfeias Pond is oligo-mesotrophic and has abundant submerged macrophytes ; Garcas Pond is eutrophic without submerged macrophytes, with cyclic cyano-bacterial blooms. Sampling was carried out monthly from January to December 1997. Phytoplankton species were classified according to taxonomic classes and the following criteria: life form, size, biovolume, life strategy (C-S-R) and functional group. Statistical differences in taxa contribution were reported for both lakes considering all criteria tested, especially life forms. Taxonomic classes dominating Ninfeias Pond were Prymnesiophyceae and Dinophyceae, which strongly influenced a community characterized by nanoplanktonic unicellular flagellated C/S-strategists, and the main functional groups were X2, L o and Wl. Garcas Pond phytoplankton community was dominated by species belonging to Cyanobacteria and colonial non-flagellated nano/micro-planktonic S-strategists, and the main functional groups were M, S N and L M. Differences in trophic status are probably the main factor triggering such differences. However, the presence of macrophytes in Ninfeias Pond also seems to qualitatively influence its phytoplankton community, favoring flagellated species.
// Runs findAccount ACCESSOR. If found returns true and deletes account. // Otherwise returns false. Does not change list_state. bool BankAccountList::deleteAccount(const string & actNum) { bool deleted = false; if (!isEmpty()) { int index = 0; bool found = findAccount(actNum, index); if (found) { List[index] = List[num_of_elements - 1]; num_of_elements--; size_t flag = list_state; list_state = 0; sort(flag); deleted = true; } else { cout << "Account Number: " << actNum << " is not in the list" << endl; } } else { cout << "List is empty." << endl; } return deleted; }
/** * Utilities for database access (DAO classes). * * @author albrecht * */ public class DaoUtils { private DaoUtils() { // prevent instances } /** * Dumps the content of a table to a csv file. * * @param tableName the table name to dump * @param sql2o initialized database access */ public static void dumpTableToCsv(final String tableName, final Sql2o sql2o) { Path file = createFileForTable(tableName); String selectQuery = createQueryForTable(tableName); dumpTableToCsv(file, selectQuery, sql2o); } private static void dumpTableToCsv(final Path file, final String selectQuery, final Sql2o sql2o) { final String sql = "CALL " + "CSVWRITE( " + String.format("'%s', ", file.toString()) + String.format("'%s', 'charset=UTF-8 fieldSeparator=;' ", selectQuery) + " );"; try (Connection con = sql2o.open()) { con.createQuery(sql).executeUpdate(); } } private static Path createFileForTable(final String tableName) { long ts = System.currentTimeMillis(); Date date = new Date(ts); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); String fileName = String.format("%s-%s.csv", tableName, sdf.format(date)); Path file = Paths.get(fileName); return file; } private static String createQueryForTable(final String tableName) { String sql = String.format("SELECT * FROM %s;", tableName); return sql; } }
The utility of serum 25-hydroxyvitamin D in predicting post- thyroidectomy hypocalcemia in thyrotoxic subjects: a single-center cohort study Thyroid surgery is the most common endocrine surgery performed worldwide. Total thyroidectomy (TT) has emerged as the procedure of choice for thyroid malignancy as well as many benign toxic goitre and nontoxic multinodular goitre with compression symptoms, in order to avoid recurrence and revision surgery. "Postoperative hypocalcemia is" remove comma and add is, a common complication after TT, which may be transient or permanent (>6 months) and is increasingly seen with this radical technique. Hypocalcemia varies from an asymptomatic biochemical abnormality to a lifethreatening tetany, depending on the duration, severity, ABSTRACT INTRODUCTION Thyroid surgery is the most common endocrine surgery performed worldwide. Total thyroidectomy (TT) has emerged as the procedure of choice for thyroid malignancy as well as many benign toxic goitre and nontoxic multinodular goitre with compression symptoms, in order to avoid recurrence and revision surgery. 1 "Postoperative hypocalcemia is" remove comma and add is, a common complication after TT, which may be transient or permanent (>6 months) and is increasingly seen with this radical technique. 2,3 Hypocalcemia varies from an asymptomatic biochemical abnormality to a lifethreatening tetany, depending on the duration, severity, and rapidity of development. In particular, thyrotoxic subjects exhibited higher rates of transient and permanent post-thyroidectomy hypocalcemia (PH) compared to euthyroid subjects. The most important cause of transient hypocalcemia is functional hypoparathyroidism, resulting from surgical trauma and devascularization of parathyroid gland and hence impaired secretion of parathormone hormone, which is the major calciotropic hormone. Vitamin D is the other major hormone involved in calcium regulation and therefore, Vitamin D deficiency (VDD), a potentially correctable factor was extensively investigated for its role in the development of postthyroidectomy hypocalcemia. The previous studies had variable results owing to wide variation in prevalence of VDD as it is latitude-specific and population based. Few high-level evidences are available regarding the impact of VDD on PH in our region. Moreover, there is no consensus regarding the threshold of vitamin D levels predisposing to the development of post-thyroidectomy hypocalcemia in thyrotoxic subjects. Therefore, we conducted this cohort study to determine the utility of 25-hydroxyvitamin D (25OHD) in predicting the development of transient hypocalcemia in thyrotoxic and euthyroid subjects undergoing TT in southern India. METHODS Consecutive patients undergoing first-time total thyroidectomy in the Department of Endocrine Surgery, Madras Medical College and Rajiv Gandhi Government General Hospital, Chennai-600003 (Latitude: 13.08⸰ N, 80.27⸰ E) from July 2017 to December 2019 were prospectively studied after obtaining Institutional ethics committee approval (No.18092012). Informed written consent obtained from all participants. The study was conducted in accordance with the Helsinki declaration and its later amendments. None of the procedures in the study involved animals. Selection of subjects Group A/thyrotoxic group Surgical candidates with new-onset overt hyperthyroidism were included. Diagnosis was based on suppressed Thyroid Stimulating Hormone (TSH) below reference range with or without elevated free thyroid hormone levels. Indications for surgery were: large volume goitre, non-compliance/resistance to antithyroid drugs, suspicion for malignancy in cytology or sonography, planning pregnancy, presence of moderate/ severe Graves' ophthalmopathy and logistic reasons including patient's preference for surgery. Group B/ euthyroid subjects Age and sex-matched euthyroid patients with benign thyroid nodule/s having compression symptoms or malignant thyroid disease who are surgical candidates were included. All the subjects were evaluated for TSH (0.35-4.5 mIU/l), free thyroxine (0.8-2.2 ng/dl), liver and renal function tests. Subjects with revision surgery, concomitant neck dissection, intentional parathyroidectomy, associated medical conditions including chronic renal or hepatic disorder, malignancy, immunosuppression, uncontrolled diabetes and those with calcium and vitamin D supplements were excluded. Preoperatively, thyrotoxic patients received antithyroid drug, Tab. Carbimazole 10-60 mg/day and propranolol 10-160 mg/day in divided doses until stably euthyroid. Under general anesthesia, classic total thyroidectomy was performed by the same surgical team as per institutional standards identifying and preserving all the parathyroid glands and both the external branch of superior laryngeal and recurrent laryngeal nerves on either side. Blood samples were collected for preoperative 25OHD at the time of diagnosis and categorized as severe deficiency<10, deficiency=10-19.9, insufficiency=20-29.9, sufficiency=30-100 ng/ml. Serum 25-OHD was measured in Siemens ADVIA Centaur using fully automated chemiluminescent immune assay method standardized against isotope dilution-liquid chromatography-tandem mass spectrometry reference methods as per vitamin D standardization programme. Serum corrected-calcium (8.5-10.4 mg/dl) and intact Parathormone (iPTH) (12-65 pg/ml) were measured with automated analyzer, Roche eCobas 6000 series, Switzerland at baseline, 24-hour, 48-hour post-surgery and as per clinical needs. In the postoperative recovery phase, clinical signs and symptoms of hypocalcemia including perioral and acral numbness, cramps, carpopedal spasm, laryngeal stridor, bronchospasm, cardiac arrythmia, seizures, Chvostek and Trousseau signs were monitored. Patients with clinically evident hypocalcemia or corrected calcium <8 mg/dl received Tab. Calcium carbonate 0.5-2g/day±Cap. Calcitriol (active vitamin D) 0.25-1 mcg/day and 10% intravenous calcium gluconate 0.5-2 mg/kg/day for resistant hypocalcemia. Subjects with vitamin D deficiency or insufficiency received high dose cholecalciferol single intramuscular injection of 6 lakh units, or per oral 60,000 IU/week for 4-12 weeks tailored to individual needs. In the follow up, Tab. Thyroxine sodium in replacement dose for benign or medullary thyroid cancer while suppressive doses were administered for differentiated thyroid cancer. Statistical analysis SPSS software version 20.0, IBM Incorp, was used for statistical analysis. Categorical data was expressed as percentage and frequency. Continuous data which was normal and non-normal on Shapiro Wilk's normality test were expressed as mean (Standard deviation) and median (Inter-Quartile Range: IQR) respectively. Chi-square test, Mann Whitney U test and Multinomial regression tests were performed where appropriate. The results were expressed as Odds ratio (OR) with 95% confidence interval (95% CI). Receiver Operating Characteristic (ROC) determined the diagnostic accuracy of the testvariable 25OHD in predicting transient hypocalcemia. Youden index determined the optimal "cut-off'" value. The area under ROC curve (AUC) with values closer 1 indicates better predictability and those closer to 0.5 indicates poorer predictability. P value<0.05 was considered statistically significant. RESULTS Out of 359 patients enrolled in the study, a total of 328 patients who underwent TT were eligible for analysis. Thyrotoxic subjects who had remission with antithyroid drug/ radioactive iodine therapy (n=16), those with lesser resection including hemithyroidectomy and isthmectomy (n=3), concomitant neck dissection (n=9) for intraoperative detection of lymphnode metastasis and those with incomplete calcium and iPTH values (n=3) were excluded. DISCUSSION Hyperthyroidism is associated with higher rate and severity of postoperative hypocalcemia compared to euthyroid subjects undergoing TT. 11,12 The phenomenon of hungry bone resulting from remineralization of bone loss associated with thyrotoxicosis induced osteoporosis is implicated as an important cause of post-thyroidectomy hypocalcemia. Hence, Vitamin D, which is an independent predictor of bone health and a potentially correctable factor was extensively studied for its role in the development of PH in thyrotoxic subjects. However, the results are variable owing to; geographic variation in vitamin D deficiency prevalence; the lack of uniformity in the utilization of 25OHD vs. 1, 25dihydroxycholecalciferol for assessment of vitamin D status; differences in the assay method and cut-off values for defining the reference range. This single-center prospective study addressed these issues and utilized serum 25-hydoxycholecalciferol, which is the major circulating form and the most reliable marker for assessment of vitamin D status. The severity of hypovitaminosis D was categorized as insufficiency, deficiency and severe deficiency in accordance with the Endocrine Society clinical practice guidelines. 18 The risk of development of PH in each category among thyrotoxic subjects was compared and contrasted with age-and sexmatched euthyroid cohorts. The present study demonstrated higher rates of transient hypocalcemia in thyrotoxic patients compared to euthyroid cohorts undergoing total thyroidectomy (58.8% vs. 22.5%), which is consistent with published reports. Although the mean levels of preoperative 25OHD was significantly diminished in thyrotoxic subjects compared to euthyroid cohorts, there was no significant difference in the percent prevalence across the categories of severe deficiency, deficiency and insufficiency between the two groups. In multinomial regression analysis, the major determinant of PH in thyrotoxic group was low levels of 48-hour iPTH (OR: 3.7) and 25OHD even in the category of severe deficiency failed to impact the development of transient hypocalcemia. The present study constructed ROC curve to assess the diagnostic accuracy of 25OHD in predicting transient hypocalcemia. In ROC analysis, classifiers that give curves to the top left corner indicates better performance and curves closer to 45-degree diagonal has less accurate results. In thyrotoxic subjects, ROC curve for the testvariable 25OHD was closer to the reference diagonal and indicates poor performance. Moreover, AUC of 0.5 has poor predictability. Thus, our study observed that preoperative 25OHD was unreliable in predicting transient hypocalcemia in thyrotoxic subjects. In contrast, preoperative 25OHD reliably predicted transient hypocalcemia in euthyroid subjects at optimal cut-off value of 17.6 ng/mL. The sensitivity and specificity were 65.4% and 64.2% respectively, though with limited PPV of 34.6%. A PPV of 34.6% implies that 65.4% of subjects would be wrongly diagnosed with false positive results. Additionally, multivariate analysis revealed that independent risk factors for PH were preoperative calcium (OR: 9.4), 48-hour iPTH (OR: 3.9) and severe 25OHD deficiency (OR: 44.1) in euthyroid subjects. Therefore, euthyroid subjects with severe 25OHD deficiency had 44-fold increased likelihood to develop transient hypocalcemia post-TT compared to 25OHD sufficient group. Hence, correction of severe vitamin D deficiency and associated hypocalcemia preoperatively in this subset of euthyroid subjects will decrease the occurrence of PH and facilitate early safe discharge. Several meta-analysis and randomized controlled trails have reported that prophylactic calcium and vitamin D supplementation facilitates same-day discharge post-TT. Literature evidences have implicated hungry bone syndrome (HBS) as an important cause of PH in thyrotoxic subjects in addition to surgically induced functional hypoparathyroidism. Hungry bone phenomenon is characterized by profound and prolonged hypocalcemia along with hypomagnesemia and hyperphosphatemia with concomitant elevation of parathyroid hormone usually 72-to 96-hours after TT and is due to rapid remineralization of bone loss associated with thyrotoxic osteodystrophy. Thus, the significantly diminished 48hour calcium and elevated 48-hour iPTH post-TT in thyrotoxic subjects compared to euthyroid group in the present study is corroborative of HBS. Michie et al had reported that higher rates of PH cannot be solely explained by functional hypoparathyroidism and showed that HBS is the mechanism of post-thyroidectomy hypocalcemia in thyrotoxic subjects. In a previous report, we have shown that HBS occurred exclusively in thyrotoxic subjects undergoing TT and correlated with the severity of bone demineralization. 13,17 Furthermore, the author has shown in the previously published reports that the radical technique of TT was associated with higher rates of PH in thyrotoxic subjects and facilitates rapid recovery of bone mineral density. 33,34 Moreover, 25OHD levels were not different in subjects exhibiting and not exhibiting PH among thyrotoxic subjects. Recently, Manzini et al had reported that decreased preoperative vitamin D levels did not predict PH, which is in keeping with our observation. 8 Limitations As vitamin D deficiency is latitude-and ethnicity-based, some of our observation could have been caused by characteristics specific to our population. The present study has not evaluated the bone mineral density nor its correlation with the severity of thyrotoxicosis and development of PH. Moreover, serum magnesium, alkaline phosphatase and other bone turnover markers which are potential predictors of PH in thyrotoxicosis were not included. CONCLUSION Serum 25OHD had limited utility in predicting transient hypocalcemia in thyrotoxic patients undergoing TT. However, preoperative 25OHD below 17.6 ng/mL was a reliable predictor of transient post-thyroidectomy hypocalcemia in euthyroid subjects, though with a limited sensitivity and specificity. Euthyroid patients with severe vitamin D deficiency had 44-fold increased likelihood of developing PH compared to 25OHD sufficient patients. Preoperative Calcium and vitamin D therapy in these patients at risk of PH will facilitate early safe discharge.
Repression of transcription mediated by dual elements in the CCAAT/enhancer binding protein alpha gene. During adipocyte differentiation, the expression of C/EBPalpha is activated, which in turn serves to transcriptionally activate numerous adipocyte genes. A previous search for cis elements that regulate transcription of the C/EBPalpha gene led to the identification of a potential repressive element within the proximal 5' flanking region of the gene. Nuclear extracts from 3T3-L1 preadipocytes, but not adipocytes, were found to contain a factor, CUP (C/EBPalpha undifferentiated protein), that binds to this site (the CUP-1 site). In the present investigation, we show that C/EBPalpha promoter-luciferase constructs containing both the proximal 5' flanking and the entire 5' untranslated regions of the gene exhibit an expression pattern during adipocyte differentiation comparable to that of the endogenous C/EBPalpha gene. Mutation of the CUP-1 site in these constructs had little effect on reporter gene expression; however, when this mutation was combined with deletion of the 5' untranslated region, reporter gene expression by preadipocytes was dramatically up-regulated. Consistent with this finding, a second CUP binding site (the CUP-2 site) was identified in the 5' untranslated region. Although mutation of either CUP element in constructs containing both the 5' flanking and 5' untranslated region had little effect on reporter gene transcription, mutation of both CUP elements markedly activated transcription. Thus, it appears that dual CUP regulatory elements repress transcription of the C/EBPalpha gene prior to induction of the adipocyte differentiation program.
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { GlobalService } from '../../global.service'; import 'rxjs/add/operator/toPromise'; @Injectable() export class DashboardService { constructor(private http: Http, private globalService: GlobalService) { } getRooms(): Promise<any> { let url = '/api/rooms'; return this.http.get(url).toPromise() .then(this.globalService.extractData) .catch(this.globalService.handleErrorPromise); } }
Induction of tolerance to hind limb allografts in rats receiving cyclosporine A and antilymphocyte serum: effect of duration of the treatment Background. This study assessed the ability of antilymphocyte serum (ALS) and cyclosporine A (CsA) to induce tolerance for hind limb composite tissue allograft in rats without chronic immunosuppression. Methods. Hind limb transplantations were performed in Lewis-Brown-Norway (LBN, RT1l+n) and Lewis (LEW, RT1l) rats. Treatment consisted of ALS only (0.4 mL/kg), CsA only (16 mg/kg), and a combination of CsA and ALS, and it was administered 12 hr before surgery at three different intervals (7, 14, and 21 days). Long-term survivors were tested for tolerance by standard skin grafting from the recipient (LEW), the donor (LBN), and the third party (ACI, RT1a) 60 days after cessation of the treatment and by mixed lymphocyte reaction at 100 days. T-cell lines were analyzed with flow cytometry. Results. Single use of ALS in all treatment intervals did not prolong allograft survival. Single use of CsA extended survival up to 23 days in the 21-day protocol group. CsA and ALS caused indefinite survival in two of six rats in the 14-day protocol and in all six rats in the 21-day protocol (>420 days). The six long-term survivors in the 21-day protocol accepted the skin grafts from the donor (LBN) and the recipient (LEW) and rejected third-party grafts (ACI). Tolerant animals showed a donor-specific hematopoietic chimerism of 35% to 42% in the peripheral blood. Mixed lymphocyte reaction assay demonstrated tolerance to the host and donor alloantigens and increased response to the third party. Conclusions. Administration of CsA and ALS for 21 days induced donor-specific tolerance in the recipients of the rat hind limb composite tissue allografts. The mechanism of tolerance should be investigated further.
import { State } from "./types"; export const INITIAL_STATE: State = { isOpen: false, };
Surface-enhanced Raman spectroscopy using gold-core platinum-shell nanoparticle film electrodes: toward a versatile vibrational strategy for electrochemical interfaces. The aim of this work is to further improve the molecular generality and substrate generality of SERS (i.e., to fully optimize the SERS activity of transition-metal electrodes). We utilized a strategy of borrowing high SERS activity from the Au core based on Au-core Pt-shell (Au@Pt) nanoparticle film electrodes, which can be simply and routinely prepared. The shell thickness from about one to five monolayers of Pt atoms can be well controlled by adjusting the ratio of the number of Au seeds to Pt(IV) ions in the solution. The SERS experimental results of carbon monoxide adsorption indicate that the enhancement factor for the Au@Pt nanoparticle film electrodes is more than 2 orders of magnitude larger than that of electrochemically roughened Pt electrodes. The practical virtues of the present film electrodes for obtaining rich and high-quality vibrational information for diverse adsorbates on transition metals are pointed out and briefly illustrated with systems of CO, hydrogen, and benzene adsorbed on Pt. We believe that the electrochemical applications of SERS will be broadened with this strategy, in particular, for extracting detailed vibrational information for adsorbates at transition-metal electrode interfaces.
Presumptive Democratic nominee Hillary Clinton met with Massachusetts Senator Elizabeth Warren in Clinton’s D.C. home following the Senator’s full-throated endorsement of Clinton and denouncement of Donald Trump. “I’m ready to get in this fight and work my heart out for Hillary Clinton to become the next president of the United States and to make sure that Donald Trump never gets anyplace close to the White House,” Warren told MSNBC’s Rachel Maddow. The endorsement and meeting further fuels speculation that Clinton will tap Warren as her running mate. Warren has been one of the strongest attackers of Trump, using social media for direct assaults on Trump’s character to argue against his candidacy. Fling as much mud as you want, @realDonaldTrump. Your words & actions disqualify you from being President – & I won’t stop saying it. She capped off the speech, tying the policies from Speaker of the House Paul Ryan and Senate Majority Leader Mitch McConnell to Donald Trump’s behavior. “Trump isn’t a different kind of candidate. He’s a Mitch McConnell kind of candidate,” she said referring to McConnell tepid endorsement of Trump. Warren is a popular liberal firebrand—with a populist appeal not unlike Bernie Sanders—and Clinton tapping Warren would help unite the two factions of the Democratic party that emerged over the course of the primary. Donald Trump weighed in, calling Warren “Pocahontas,” “Goofy,” and said that he hopes that she’s picked for V.P.
/* Copyright IBM Corp. 2017 All Rights Reserved. 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. */ package sw import ( "crypto/sha256" "errors" "reflect" "testing" mocks2 "github.com/hyperledger/fabric/bccsp/mocks" "github.com/hyperledger/fabric/bccsp/sw/mocks" "github.com/stretchr/testify/assert" ) func TestHash(t *testing.T) { t.Parallel() expectetMsg := []byte{1, 2, 3, 4} expectedOpts := &mocks2.HashOpts{} expectetValue := []byte{1, 2, 3, 4, 5} expectedErr := errors.New("Expected Error") hashers := make(map[reflect.Type]Hasher) hashers[reflect.TypeOf(&mocks2.HashOpts{})] = &mocks.Hasher{ MsgArg: expectetMsg, OptsArg: expectedOpts, Value: expectetValue, Err: nil, } csp := CSP{hashers: hashers} value, err := csp.Hash(expectetMsg, expectedOpts) assert.Equal(t, expectetValue, value) assert.Nil(t, err) hashers = make(map[reflect.Type]Hasher) hashers[reflect.TypeOf(&mocks2.HashOpts{})] = &mocks.Hasher{ MsgArg: expectetMsg, OptsArg: expectedOpts, Value: nil, Err: expectedErr, } csp = CSP{hashers: hashers} value, err = csp.Hash(expectetMsg, expectedOpts) assert.Nil(t, value) assert.Contains(t, err.Error(), expectedErr.Error()) } func TestGetHash(t *testing.T) { t.Parallel() expectedOpts := &mocks2.HashOpts{} expectetValue := sha256.New() expectedErr := errors.New("Expected Error") hashers := make(map[reflect.Type]Hasher) hashers[reflect.TypeOf(&mocks2.HashOpts{})] = &mocks.Hasher{ OptsArg: expectedOpts, ValueHash: expectetValue, Err: nil, } csp := CSP{hashers: hashers} value, err := csp.GetHash(expectedOpts) assert.Equal(t, expectetValue, value) assert.Nil(t, err) hashers = make(map[reflect.Type]Hasher) hashers[reflect.TypeOf(&mocks2.HashOpts{})] = &mocks.Hasher{ OptsArg: expectedOpts, ValueHash: expectetValue, Err: expectedErr, } csp = CSP{hashers: hashers} value, err = csp.GetHash(expectedOpts) assert.Nil(t, value) assert.Contains(t, err.Error(), expectedErr.Error()) } func TestHasher(t *testing.T) { t.Parallel() hasher := &hasher{hash: sha256.New} msg := []byte("Hello World") out, err := hasher.Hash(msg, nil) assert.NoError(t, err) h := sha256.New() h.Write(msg) out2 := h.Sum(nil) assert.Equal(t, out, out2) hf, err := hasher.GetHash(nil) assert.NoError(t, err) assert.Equal(t, hf, sha256.New()) }
<reponame>coocoo90/gluon-cv<gh_stars>0 # pylint: disable=missing-function-docstring, missing-class-docstring, unused-argument """R2Plus1D, https://arxiv.org/abs/1711.11248. Code adapted from https://github.com/pytorch/vision/blob/master/torchvision/models/video/resnet.py.""" import torch import torch.nn as nn from torch.nn import BatchNorm3d __all__ = ['R2Plus1D', 'r2plus1d_v1_resnet18_kinetics400', 'r2plus1d_v1_resnet34_kinetics400', 'r2plus1d_v1_resnet50_kinetics400', 'r2plus1d_v1_resnet101_kinetics400', 'r2plus1d_v1_resnet152_kinetics400'] def conv3x1x1(in_planes, out_planes, spatial_stride=1, temporal_stride=1, dilation=1): """3x1x1 convolution with padding""" return nn.Conv3d(in_channels=in_planes, out_channels=out_planes, kernel_size=(3, 1, 1), stride=(temporal_stride, spatial_stride, spatial_stride), padding=(dilation, 0, 0), dilation=dilation, bias=False) class Conv2Plus1D(nn.Module): def __init__(self, inplanes, planes, midplanes, stride=1, padding=1, norm_layer=BatchNorm3d, norm_kwargs=None, **kwargs): super(Conv2Plus1D, self).__init__() self.conv1 = nn.Conv3d(in_channels=inplanes, out_channels=midplanes, kernel_size=(1, 3, 3), stride=(1, stride, stride), padding=(0, padding, padding), bias=False) self.bn1 = norm_layer(num_features=midplanes, **({} if norm_kwargs is None else norm_kwargs)) self.relu = nn.ReLU(inplace=False) self.conv2 = nn.Conv3d(in_channels=midplanes, out_channels=planes, kernel_size=(3, 1, 1), stride=(stride, 1, 1), padding=(padding, 0, 0), bias=False) def forward(self, x): x = self.conv1(x) x = self.bn1(x) x = self.relu(x) x = self.conv2(x) return x class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None, norm_layer=BatchNorm3d, norm_kwargs=None, layer_name='', **kwargs): super(BasicBlock, self).__init__() self.downsample = downsample midplanes = (inplanes * planes * 3 * 3 * 3) // (inplanes * 3 * 3 + 3 * planes) self.conv1 = Conv2Plus1D(inplanes, planes, midplanes, stride) self.bn1 = norm_layer(num_features=planes, **({} if norm_kwargs is None else norm_kwargs)) self.relu = nn.ReLU(inplace=False) self.conv2 = Conv2Plus1D(planes, planes, midplanes) self.bn2 = norm_layer(num_features=planes, **({} if norm_kwargs is None else norm_kwargs)) def forward(self, x): identity = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) if self.downsample is not None: identity = self.downsample(x) out = out + identity out = self.relu(out) return out class Bottleneck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1, downsample=None, norm_layer=BatchNorm3d, norm_kwargs=None, layer_name='', **kwargs): super(Bottleneck, self).__init__() self.downsample = downsample midplanes = (inplanes * planes * 3 * 3 * 3) // (inplanes * 3 * 3 + 3 * planes) # 1x1x1 self.conv1 = nn.Conv3d(in_channels=inplanes, out_channels=planes, kernel_size=1, bias=False) self.bn1 = norm_layer(num_features=planes, **({} if norm_kwargs is None else norm_kwargs)) self.relu = nn.ReLU(inplace=False) # Second kernel self.conv2 = Conv2Plus1D(planes, planes, midplanes, stride) self.bn2 = norm_layer(num_features=planes, **({} if norm_kwargs is None else norm_kwargs)) self.conv3 = nn.Conv3d(in_channels=planes, out_channels=planes * self.expansion, kernel_size=1, bias=False) self.bn3 = norm_layer(num_features=planes * self.expansion, **({} if norm_kwargs is None else norm_kwargs)) def forward(self, x): identity = x out = self.conv1(x) out = self.bn1(out) out = self.relu(out) out = self.conv2(out) out = self.bn2(out) out = self.relu(out) out = self.conv3(out) out = self.bn3(out) if self.downsample is not None: identity = self.downsample(x) out = out + identity out = self.relu(out) return out class R2Plus1D(nn.Module): r"""The R2+1D network. A Closer Look at Spatiotemporal Convolutions for Action Recognition. CVPR, 2018. https://arxiv.org/abs/1711.11248 """ def __init__(self, num_classes, block, layers, dropout_ratio=0.5, num_segment=1, num_crop=1, feat_ext=False, init_std=0.001, partial_bn=False, norm_layer=BatchNorm3d, norm_kwargs=None, **kwargs): super(R2Plus1D, self).__init__() self.partial_bn = partial_bn self.dropout_ratio = dropout_ratio self.init_std = init_std self.num_segment = num_segment self.num_crop = num_crop self.feat_ext = feat_ext self.inplanes = 64 self.feat_dim = 512 * block.expansion self.conv1 = nn.Conv3d(in_channels=3, out_channels=45, kernel_size=(1, 7, 7), stride=(1, 2, 2), padding=(0, 3, 3), bias=False) self.bn1 = norm_layer(num_features=45, **({} if norm_kwargs is None else norm_kwargs)) self.relu = nn.ReLU(inplace=True) self.conv2 = conv3x1x1(in_planes=45, out_planes=64) self.bn2 = norm_layer(num_features=64, **({} if norm_kwargs is None else norm_kwargs)) if self.partial_bn: if norm_kwargs is not None: norm_kwargs['use_global_stats'] = True else: norm_kwargs = {} norm_kwargs['use_global_stats'] = True self.layer1 = self._make_res_layer(block=block, planes=64, blocks=layers[0], layer_name='layer1_') self.layer2 = self._make_res_layer(block=block, planes=128, blocks=layers[1], stride=2, layer_name='layer2_') self.layer3 = self._make_res_layer(block=block, planes=256, blocks=layers[2], stride=2, layer_name='layer3_') self.layer4 = self._make_res_layer(block=block, planes=512, blocks=layers[3], stride=2, layer_name='layer4_') self.avgpool = nn.AdaptiveAvgPool3d(output_size=(1, 1, 1)) self.dropout = nn.Dropout(self.dropout_ratio) self.fc = nn.Linear(in_features=self.feat_dim, out_features=num_classes) nn.init.normal_(self.fc.weight, 0, self.init_std) nn.init.constant_(self.fc.bias, 0) def _make_res_layer(self, block, planes, blocks, stride=1, norm_layer=BatchNorm3d, norm_kwargs=None, layer_name=''): """Build each stage of a ResNet""" downsample = None if stride != 1 or self.inplanes != planes * block.expansion: downsample = nn.Sequential( nn.Conv3d(in_channels=self.inplanes, out_channels=planes * block.expansion, kernel_size=1, stride=(stride, stride, stride), bias=False), norm_layer(num_features=planes * block.expansion, **({} if norm_kwargs is None else norm_kwargs))) layers = [] layers.append(block(inplanes=self.inplanes, planes=planes, stride=stride, downsample=downsample)) self.inplanes = planes * block.expansion for _ in range(1, blocks): layers.append(block(inplanes=self.inplanes, planes=planes)) return nn.Sequential(*layers) def forward(self, x): bs, _, _, _, _ = x.size() x = self.conv1(x) x = self.bn1(x) x = self.relu(x) x = self.conv2(x) x = self.bn2(x) x = self.relu(x) x = self.layer1(x) x = self.layer2(x) x = self.layer3(x) x = self.layer4(x) x = self.avgpool(x) x = x.view(bs, -1) if self.feat_ext: return x x = self.fc(self.dropout(x)) return x def r2plus1d_v1_resnet18_kinetics400(cfg): model = R2Plus1D(num_classes=cfg.CONFIG.DATA.NUM_CLASSES, block=BasicBlock, layers=[2, 2, 2, 2], num_segment=cfg.CONFIG.DATA.NUM_SEGMENT, num_crop=cfg.CONFIG.DATA.NUM_CROP, feat_ext=cfg.CONFIG.INFERENCE.FEAT, partial_bn=cfg.CONFIG.MODEL.PARTIAL_BN) if cfg.CONFIG.MODEL.PRETRAINED: from ..model_store import get_model_file model.load_state_dict(torch.load(get_model_file('r2plus1d_v1_resnet18_kinetics400', tag=cfg.CONFIG.MODEL.PRETRAINED))) return model def r2plus1d_v1_resnet34_kinetics400(cfg): model = R2Plus1D(num_classes=cfg.CONFIG.DATA.NUM_CLASSES, block=BasicBlock, layers=[3, 4, 6, 3], num_segment=cfg.CONFIG.DATA.NUM_SEGMENT, num_crop=cfg.CONFIG.DATA.NUM_CROP, feat_ext=cfg.CONFIG.INFERENCE.FEAT, partial_bn=cfg.CONFIG.MODEL.PARTIAL_BN) if cfg.CONFIG.MODEL.PRETRAINED: from ..model_store import get_model_file model.load_state_dict(torch.load(get_model_file('r2plus1d_v1_resnet34_kinetics400', tag=cfg.CONFIG.MODEL.PRETRAINED))) return model def r2plus1d_v1_resnet50_kinetics400(cfg): model = R2Plus1D(num_classes=cfg.CONFIG.DATA.NUM_CLASSES, block=Bottleneck, layers=[3, 4, 6, 3], num_segment=cfg.CONFIG.DATA.NUM_SEGMENT, num_crop=cfg.CONFIG.DATA.NUM_CROP, feat_ext=cfg.CONFIG.INFERENCE.FEAT, partial_bn=cfg.CONFIG.MODEL.PARTIAL_BN) if cfg.CONFIG.MODEL.PRETRAINED: from ..model_store import get_model_file model.load_state_dict(torch.load(get_model_file('r2plus1d_v1_resnet50_kinetics400', tag=cfg.CONFIG.MODEL.PRETRAINED))) return model def r2plus1d_v1_resnet101_kinetics400(cfg): model = R2Plus1D(num_classes=cfg.CONFIG.DATA.NUM_CLASSES, block=Bottleneck, layers=[3, 4, 23, 3], num_segment=cfg.CONFIG.DATA.NUM_SEGMENT, num_crop=cfg.CONFIG.DATA.NUM_CROP, feat_ext=cfg.CONFIG.INFERENCE.FEAT, partial_bn=cfg.CONFIG.MODEL.PARTIAL_BN) if cfg.CONFIG.MODEL.PRETRAINED: from ..model_store import get_model_file model.load_state_dict(torch.load(get_model_file('r2plus1d_v1_resnet101_kinetics400', tag=cfg.CONFIG.MODEL.PRETRAINED))) return model def r2plus1d_v1_resnet152_kinetics400(cfg): model = R2Plus1D(num_classes=cfg.CONFIG.DATA.NUM_CLASSES, block=Bottleneck, layers=[3, 8, 36, 3], num_segment=cfg.CONFIG.DATA.NUM_SEGMENT, num_crop=cfg.CONFIG.DATA.NUM_CROP, feat_ext=cfg.CONFIG.INFERENCE.FEAT, partial_bn=cfg.CONFIG.MODEL.PARTIAL_BN) if cfg.CONFIG.MODEL.PRETRAINED: from ..model_store import get_model_file model.load_state_dict(torch.load(get_model_file('r2plus1d_v1_resnet152_kinetics400', tag=cfg.CONFIG.MODEL.PRETRAINED))) return model
package com.maxmind.geoip2.model; import com.fasterxml.jackson.annotation.JacksonInject; import com.fasterxml.jackson.annotation.JsonProperty; import com.maxmind.geoip2.record.*; import java.util.ArrayList; /** * <p> * This class provides a model for the data returned by the GeoIP2 Precision: * City end point and the GeoIP2 City database. * </p> * <p> * The only difference between the City and Insights model classes is which * fields in each record may be populated. * </p> * <p> * * @see <a href="http://dev.maxmind.com/geoip/geoip2/web-services">GeoIP2 Web * Services</a> * </p> */ public final class CityResponse extends AbstractCityResponse { CityResponse() { this(null, null, null, null, null, null, null, null, null, null); } public CityResponse( @JsonProperty("city") City city, @JsonProperty("continent") Continent continent, @JsonProperty("country") Country country, @JsonProperty("location") Location location, @JsonProperty("maxmind") MaxMind maxmind, @JsonProperty("postal") Postal postal, @JsonProperty("registered_country") Country registeredCountry, @JsonProperty("represented_country") RepresentedCountry representedCountry, @JsonProperty("subdivisions") ArrayList<Subdivision> subdivisions, @JacksonInject("traits") @JsonProperty("traits") Traits traits ) { super(city, continent, country, location, maxmind, postal, registeredCountry, representedCountry, subdivisions, traits); } }
Swarm Rules for Autonomous Vehicles in a Parking Lot In this research, we aim at acquiring the moving behavior of each vehicle in a parking lot only for entering vehicles. The behaviors of each vehicle are desired based on the neighborhood environment of the vehicle, and they are not desired based on the whole environment in the parking lot with depending on the other vehicles' decision. Therefore, this research is a kind of studies about swarm robots. In this paper, vehicles are modeled in the parking lot for simulation. We confirm that the vehicle can reach the exit in the parking lot in simulation.
import { createService } from "./infrastructure/rpc"; import helloWorld from "./functions/helloWorld"; import welcomeMessage from "./functions/welcomeMessage"; import helloWorldWithContext from "./functions/helloWorldWithContext"; import { hook } from "./middleware/hook"; import { audit } from "./middleware/audit"; import { setCallContext } from "./middleware/setCallContext"; export const complexApiExample = createService({ functions: { helloWorld, welcomeMessageAudit: hook(welcomeMessage, { after: audit }), }, started: (context) => { console.log(`started, start: ${context.set("start", Date.now())}`); }, stopped: (context) => { console.log(`stopped, start: ${context.get<number>("start") - Date.now()}`); }, domain: "example.company.api", path: { prefix: "/complex/rpc" } }) export const simpleApiExample = createService({ functions: { helloWorld }, domain: "example.company.api", path: { prefix: "/simple/rpc" } }) export const simpleApiWithContextExample = createService({ functions: { helloWorldWithContext: hook(helloWorldWithContext, { before: setCallContext("call_message", "Tere"), after: audit }) }, started: (context) => context.set("startup_message", "Tere"), domain: "example.company.api", path: { prefix: "/simple/rpc" } })
Antagonism of adenosine A2A receptor expressed by lung adenocarcinoma tumor cells and cancer associated fibroblasts inhibits their growth Recently it has become clear that the cost associated with the Warburg effect, which is inefficient production of ATP, is offset by selective advantages that are produced by resultant intracellular metabolic alterations. In fact tumors may be addicted to the Warburg effect. In addition these alterations result in changes in the extracellular tumor microenvironment that can also produce selective advantages for tumor cell growth and survival. One such extracellular alteration is increased adenosine concentrations that have been shown to impair T cell mediated rejection and support angiogenesis. The expression of the A2A receptor in non-small cell cancer (NSCLC) tissues, cell lines and cancer associated fibroblasts (CAF) was determined by performing immunohistrochemistry and immunoblot analysis. The efficacy of the A2A receptor antagonists in vivo was evaluated in a PC9 xenograft model. To determine the mode of cell death induced by A2A receptor antagonists flow cytometry, immunoblot, and cytotoxic analysis were performed. We found that a significant number of lung adenocarcinomas express adenosine A2A receptors. Antagonism of these receptors impaired CAF and tumor cell growth in vitro and inhibited human tumor xenograft growth in mice. These observations add to the rationale for testing adenosine A2A receptor antagonists as anticancer therapeutics. Not only could there be prevention of negative signaling in T cells within the tumor microenvironment and inhibition of angiogenesis, but also an inhibitory effect on tumor-promoting, immunosuppressive CAFs and a direct inhibitory effect on the tumor cells themselves.
(Reuters/Hamad I Mohammed)A smiley face is left in the skies by the DHL Extra 300 aerobatic plane during the Bahrain International Air Show held at the Sakir airbase south of Manama, January 17, 2014. An emoji Bible is about to be launched on May 29 by a mysterious person whose real identity is hidden behind an emoji wearing sunglasses. In a move that aims to keep up with the current trend of technology, a mysterious person has come up with an emoji translation of the Bible. Instead of the usual Oxford English or other standard languages, people can soon read the Bible in picture symbols, according to The Memo. In an interview with the publication, the creator of the Bible with emojis said the project is all about accessibility. Emojis allow people to convey their feelings more accurately using pictures incorporated into the usual language. "Emojis are emotional, and allow people to express feelings in a visual way within the structure of "normal," written language," the creator of the emoji Bible told The Memo. "What's made them so successful, is that they're language-agnostic — they allow you to convey an idea to anyone, regardless of what language they speak." The emoji Bible was put together by first launching the emoji translator and tracing the words in the King James Version Bible that could be replaced with an emoji. Then, a translator program with more than 80 icons corresponding with 200 words was also created. Common shorthand symbols were also added to the program. While some people had unpleasant reactions to the emoji Bible, Scripture Union's Digital Content Manager Caleb Woodbridge thinks it is a fantastic idea. He says it is an exciting way to convey the gospel to the new generation, Premier relays. The project creator hopes that the use of emoji will help the Bible reach a lot more people. He also hopes the Bible with emojis will climb to the top 5 or 10 books in the iBooks store. He is also planning to create more books using the emoji program in the future.
Note on the Logic of Replicating Implementations Before and After Publishing a Model This short paper introduces a hypothesis complementary to the current logic of replicating computerized models in social simulations. It is submitted that the logic of cumulative knowledge provided by the process of peer reviewing may become more resourceful once the effort of replication becomes focused on producing multiple computerized versions of the same conceptual model before actually submitting it for peer reviewing, in contrast to the usual practice of having other teams aligning and replicating models after they have already been reviewed, accepted and published. Note that while this is a similar approach to Edmonds and Hales proposal, it differs from a methodological point of view, insofar as they double replicated an already published model. While this approach would require more manpower in simulation projects, it is argued here that the resulting benefits may override the costs, particularly in participative-based simulations, where potential underverified simulations may lead, nevertheless, to the actual implementation of policies with unpredictable effects in the economic and social life of stakeholders. 1 The Logic of Replication and Challenges in Simulation The goal of this short article is to contribute a few reflections for the problem of replicating social science simulations. A hypotheses is introduced which may be both complementary and alternative to the current logic of replicating computerized models in social simulations, namely : that the logic of cumulative knowledge provided by the process of peer reviewing may become more resourceful once the effort of replication becomes focused on producing multiple computerized versions of the conceptual model before submitting the latter for peer reviewing. This contrasts the usual practice of having other teams replicating models after they have already been reviewed, accepted and published. This proposal draws on methodological and epistemological arguments, as well as one technological argument: a) Rather than the computerized model, it is the conceptual model that is susceptible to being confirmed or infirmed by the scientific community. It is the conceptual model that is internalized, transformed, generalized and connected to other disciplines and methods, and eventually incorporated into a community consciousness,1 in contrast to the inability of computer programs to become scrutinized by the scientific community. b) Only very simple and highly abstract models in the sense of the Axelrods KISS motto are susceptible to being re-implemented; however, if one adopts a KIDS philosophy for constructing simulations,2 which is a typical approach in participative-based simulations, computerized models are hardly susceptible to becoming re-implemented by other teams, given the context dependency of individual and institutional stakeholders opinions; however, these models can and, it is argued, should be subject to replication by the team proposing the model, before publishing or applying its results in the relevant field. This seems particularly important in policy making, where unreplicated simulations in complex domains run the risk of being under verified, while leading to the implementation of specific policies which influence the economic and social context of individual and institutional stakeholders. c) Often, the correspondence among conceptual and computerized models is not only established formally and empirically, but also intentionally by researchers and stakeholders. Insofar as the semantic richness of social processes surpasses the empirical expressiveness of computer programs, the intended meanings ascribed to computer programs are evaluated experimentally in an intentional way. This means that the conceptual model is actually the one being internalized by the researchers and stakeholders along the executions of the computerized model, whereas the syntactic structure and operational semantics of the computerized model plays a secondary role in interpreting experiments.3 d) Articles on replication seem to have a low academic return (). Most replications seem to be presented in forums especially dedicated to replication4, rather than resulting from spontaneous confirmation or infirmation by other scientists according to the logic of peer reviewing and cumulative science, except when the goal is to extend the original conceptual model. e) The increasing portability of programming languages for the Web, such as Java and XML, provides technologies for executing and visualizing models through Applets or Servlets on the Internet. These technologies may be able to facilitate the comparative analysis of different implementations of the 1 C.f. De Millo et al.. 2 See Edmonds and Moss. 3 See David et al. (2005;2007). 4 For instance, the well known Model-to-Model workshops. same model, and are susceptible to being submitted to peer-review together with the description of the conceptual model. 2. Replication through N-Version in the Development Process Given all these reasons, it is suggested that the following topics be introduced into the methodological debate: 1) A distinction between replicating a model before and after it has been submitted for peer reviewing and published for the first time; 2) Two or more replicas of the computerized model should be submitted to the peer-review process along with the conceptual model, in order to confirm the verifiability of the results obtained, under the penalty of having the article rejected for reviewing and publication. Like Edmonds and Hales, the author believes that an unreplicated simulation is an untrustworthy simulation one should not rely on their results, they are almost certainly wrong, in the sense that the computerized model differs from what was intended or assumed in the conceptual model. This is the well-known problem of verification.5 Fig. 1. Replication through multiple versions vs. replication for model alignment. The report of Edmonds and Hales is indeed particularly informative in this context. In order to align with a published conceptual model, they had to rely on a double 5 For a definition of the term verification in the context of simulation see David. Iterative Processs
<filename>SharedLibGDX/src/main/java/info/lusito/mapeditor/sharedlibgdx/input/PanInputHandler.java package info.lusito.mapeditor.sharedlibgdx.input; import com.badlogic.gdx.Input; import com.badlogic.gdx.InputAdapter; public class PanInputHandler extends InputAdapter { private int dragStartX, dragStartY; private boolean dragging; private final Controller controller; public PanInputHandler(Controller controller) { this.controller = controller; } @Override public boolean mouseMoved(int screenX, int screenY) { if (dragging) { doDrag(screenX, screenY); return true; } return false; } @Override public boolean touchDragged(int screenX, int screenY, int pointer) { if (dragging) { doDrag(screenX, screenY); return true; } return false; } @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { if (button == Input.Buttons.MIDDLE) { initDrag(screenX, screenY); return true; } return false; } @Override public boolean touchUp(int screenX, int screenY, int pointer, int button) { if (button == Input.Buttons.MIDDLE) { stopDrag(); return true; } return false; } @Override public boolean keyDown(int keycode) { if (keycode == Input.Keys.SPACE) { Input input = controller.getInput(); initDrag(input.getX(), input.getY()); return true; } return false; } @Override public boolean keyUp(int keycode) { if (keycode == Input.Keys.SPACE) { stopDrag(); return true; } return false; } private void doDrag(int screenX, int screenY) { int diffX = screenX - dragStartX; int diffY = screenY - dragStartY; dragStartX = screenX; dragStartY = screenY; controller.moveCamera(-diffX, -diffY); } private void initDrag(int screenX, int screenY) { if (!dragging) { dragStartX = screenX; dragStartY = screenY; dragging = true; } } private void stopDrag() { dragging = false; } public interface Controller { public Input getInput(); public void moveCamera(int diffX, int diffY); } }
Bendamustine can be a bridge to allogeneic transplantation in relapsed Hodgkin lymphoma refractory to brentuximab vedotin Hodgkin lymphoma (HL) affects approximately 1500 new patients annually in the UK (Smith et al, 2011). Most patients are cured with ABVD (doxorubicin, bleomycin, vinblastine, dacarbazine)-based treatment. Of those who relapse, about 60% achieve durable remission with salvage chemotherapy followed by consolidation high dose therapy (HDT) and autologous stem cell transplantation (ASCT). Treatment options at relapse after ASCT are limited and after second relapse, cure is infrequent. Brentuximab vedotin (BV) (Adcetris) is a CD30-directed antibody drug conjugate with an established role in treating relapsed/refractory HL (Gopal et al, 2012; Younes et al, 2012). In the UK, BV has been successfully used as a bridge to allogeneic stem cell transplantation (alloSCT) in approximately 25% of patients (Gibb et al, 2013). Nivolumab and other emerging PD-1 (PD1)/PD-L1 (CD274) checkpoint inhibitors are novel agents with very promising results in early phase clinical trials. In a phase l study of nivolumab involving 23 patients (including 78% post-ACST and 78% post-BV) the overall response rate (ORR) was 87% with 86% progression-free survival (PFS) at 24 weeks (Ansell et al, 2015).
<gh_stars>10-100 /* This file is part of the WebKit open source project. This file has been generated by generate-bindings.pl. DO NOT MODIFY! This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #if ENABLE(METER_TAG) #include "JSHTMLMeterElement.h" #include "HTMLFormElement.h" #include "HTMLMeterElement.h" #include "JSHTMLFormElement.h" #include "JSNodeList.h" #include "NameNodeList.h" #include "NodeList.h" #include <wtf/GetPtr.h> using namespace JSC; namespace WebCore { ASSERT_CLASS_FITS_IN_CELL(JSHTMLMeterElement); /* Hash table */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSHTMLMeterElementTableValues[10] = { { "value", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementValue), (intptr_t)setJSHTMLMeterElementValue THUNK_GENERATOR(0) }, { "min", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementMin), (intptr_t)setJSHTMLMeterElementMin THUNK_GENERATOR(0) }, { "max", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementMax), (intptr_t)setJSHTMLMeterElementMax THUNK_GENERATOR(0) }, { "low", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementLow), (intptr_t)setJSHTMLMeterElementLow THUNK_GENERATOR(0) }, { "high", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementHigh), (intptr_t)setJSHTMLMeterElementHigh THUNK_GENERATOR(0) }, { "optimum", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementOptimum), (intptr_t)setJSHTMLMeterElementOptimum THUNK_GENERATOR(0) }, { "form", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementForm), (intptr_t)0 THUNK_GENERATOR(0) }, { "labels", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementLabels), (intptr_t)0 THUNK_GENERATOR(0) }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMeterElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSHTMLMeterElementTable = { 32, 31, JSHTMLMeterElementTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSHTMLMeterElementConstructorTableValues[1] = { { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSHTMLMeterElementConstructorTable = { 1, 0, JSHTMLMeterElementConstructorTableValues, 0 }; class JSHTMLMeterElementConstructor : public DOMConstructorObject { public: JSHTMLMeterElementConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*); virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); static const JSC::ClassInfo s_info; static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) { return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info); } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; }; const ClassInfo JSHTMLMeterElementConstructor::s_info = { "HTMLMeterElementConstructor", &DOMConstructorObject::s_info, &JSHTMLMeterElementConstructorTable, 0 }; JSHTMLMeterElementConstructor::JSHTMLMeterElementConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject) : DOMConstructorObject(structure, globalObject) { ASSERT(inherits(&s_info)); putDirect(exec->globalData(), exec->propertyNames().prototype, JSHTMLMeterElementPrototype::self(exec, globalObject), DontDelete | ReadOnly); } bool JSHTMLMeterElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot<JSHTMLMeterElementConstructor, JSDOMWrapper>(exec, &JSHTMLMeterElementConstructorTable, this, propertyName, slot); } bool JSHTMLMeterElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor<JSHTMLMeterElementConstructor, JSDOMWrapper>(exec, &JSHTMLMeterElementConstructorTable, this, propertyName, descriptor); } /* Hash table for prototype */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSHTMLMeterElementPrototypeTableValues[1] = { { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR static JSC_CONST_HASHTABLE HashTable JSHTMLMeterElementPrototypeTable = { 1, 0, JSHTMLMeterElementPrototypeTableValues, 0 }; const ClassInfo JSHTMLMeterElementPrototype::s_info = { "HTMLMeterElementPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSHTMLMeterElementPrototypeTable, 0 }; JSObject* JSHTMLMeterElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype<JSHTMLMeterElement>(exec, globalObject); } const ClassInfo JSHTMLMeterElement::s_info = { "HTMLMeterElement", &JSHTMLElement::s_info, &JSHTMLMeterElementTable, 0 }; JSHTMLMeterElement::JSHTMLMeterElement(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLMeterElement> impl) : JSHTMLElement(structure, globalObject, impl) { ASSERT(inherits(&s_info)); } JSObject* JSHTMLMeterElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject) { return new (exec) JSHTMLMeterElementPrototype(exec->globalData(), globalObject, JSHTMLMeterElementPrototype::createStructure(exec->globalData(), JSHTMLElementPrototype::self(exec, globalObject))); } bool JSHTMLMeterElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticValueSlot<JSHTMLMeterElement, Base>(exec, &JSHTMLMeterElementTable, this, propertyName, slot); } bool JSHTMLMeterElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor<JSHTMLMeterElement, Base>(exec, &JSHTMLMeterElementTable, this, propertyName, descriptor); } JSValue jsHTMLMeterElementValue(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = jsNumber(imp->value()); return result; } JSValue jsHTMLMeterElementMin(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = jsNumber(imp->min()); return result; } JSValue jsHTMLMeterElementMax(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = jsNumber(imp->max()); return result; } JSValue jsHTMLMeterElementLow(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = jsNumber(imp->low()); return result; } JSValue jsHTMLMeterElementHigh(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = jsNumber(imp->high()); return result; } JSValue jsHTMLMeterElementOptimum(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = jsNumber(imp->optimum()); return result; } JSValue jsHTMLMeterElementForm(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->form())); return result; } JSValue jsHTMLMeterElementLabels(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); UNUSED_PARAM(exec); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->labels())); return result; } JSValue jsHTMLMeterElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSHTMLMeterElement* domObject = static_cast<JSHTMLMeterElement*>(asObject(slotBase)); return JSHTMLMeterElement::getConstructor(exec, domObject->globalObject()); } void JSHTMLMeterElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { lookupPut<JSHTMLMeterElement, Base>(exec, propertyName, value, &JSHTMLMeterElementTable, this, slot); } void setJSHTMLMeterElementValue(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(thisObject); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); ExceptionCode ec = 0; imp->setValue(value.toNumber(exec), ec); setDOMException(exec, ec); } void setJSHTMLMeterElementMin(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(thisObject); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); ExceptionCode ec = 0; imp->setMin(value.toNumber(exec), ec); setDOMException(exec, ec); } void setJSHTMLMeterElementMax(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(thisObject); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); ExceptionCode ec = 0; imp->setMax(value.toNumber(exec), ec); setDOMException(exec, ec); } void setJSHTMLMeterElementLow(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(thisObject); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); ExceptionCode ec = 0; imp->setLow(value.toNumber(exec), ec); setDOMException(exec, ec); } void setJSHTMLMeterElementHigh(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(thisObject); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); ExceptionCode ec = 0; imp->setHigh(value.toNumber(exec), ec); setDOMException(exec, ec); } void setJSHTMLMeterElementOptimum(ExecState* exec, JSObject* thisObject, JSValue value) { JSHTMLMeterElement* castedThis = static_cast<JSHTMLMeterElement*>(thisObject); HTMLMeterElement* imp = static_cast<HTMLMeterElement*>(castedThis->impl()); ExceptionCode ec = 0; imp->setOptimum(value.toNumber(exec), ec); setDOMException(exec, ec); } JSValue JSHTMLMeterElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSHTMLMeterElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); } } #endif // ENABLE(METER_TAG)
package com.javaedge.concurrency.atomic; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.LongAdder; /** * 测试用例: 同时运行2秒,检查谁的次数最多 * * @author JavaEdge * @date 2019/10/18 */ public class LongAdderDemo { private long count = 0; /** * 同步代码块的方式 * @throws InterruptedException */ public void testSync() throws InterruptedException { for (int i = 0; i < 3; i++) { new Thread(() -> { long starttime = System.currentTimeMillis(); while (System.currentTimeMillis() - starttime < 2000) { // 运行两秒 synchronized (this) { ++count; } } long endtime = System.currentTimeMillis(); System.out.println("SyncThread spend:" + (endtime - starttime) + "ms" + " v" + count); }).start(); } } /** * Atomic方式 */ private AtomicLong acount = new AtomicLong(0L); public void testAtomic() throws InterruptedException { for (int i = 0; i < 3; i++) { new Thread(() -> { long starttime = System.currentTimeMillis(); while (System.currentTimeMillis() - starttime < 2000) { // 运行两秒 acount.incrementAndGet(); // acount++; } long endtime = System.currentTimeMillis(); System.out.println("AtomicThread spend:" + (endtime - starttime) + "ms" + " v-" + acount.incrementAndGet()); }).start(); } } // LongAdder 方式 private LongAdder lacount = new LongAdder(); public void testLongAdder() throws InterruptedException { for (int i = 0; i < 3; i++) { new Thread(() -> { long starttime = System.currentTimeMillis(); while (System.currentTimeMillis() - starttime < 2000) { // 运行两秒 lacount.increment(); } long endtime = System.currentTimeMillis(); System.out.println("LongAdderThread spend:" + (endtime - starttime) + "ms" + " v-" + lacount.sum()); }).start(); } } public static void main(String[] args) throws InterruptedException { LongAdderDemo demo = new LongAdderDemo(); demo.testSync(); demo.testAtomic(); demo.testLongAdder(); } }
Efficacy and Safety of Cabergoline as First Line Treatment for Invasive Giant Prolactinoma Although cabergoline is effective in the treatment of micro- and macro-prolactinoma, little is known about its efficacy in the treatment of invasive giant prolactinoma. We investigated the efficacy and safety of cabergoline in 10 male patients with invasive giant prolactinoma. Before treatment, mean serum prolactin level was 11,426 ng/mL (range, 1,450-33,200 ng/mL) and mean maximum tumor diameter was 51 mm (range, 40-77 mm). Three months after initiation of cabergoline treatment, serum prolactin concentrations decreased more than 97% in 9 patients; at last follow-up (mean treatment duration, 19 months), the mean decrease in serum prolactin concentrations was 98%, with 5 patients having normal serum prolactin levels. At first MRI follow-up (3-12 months after initiation of cabergoline), the mean reduction in tumor size was 85±4% (range, 57-98%). Cabergoline treatment for more than 12 months caused a greater reduction in tumor size compared to the treatment for less than 12 months (97±1% vs. 78±7%, P<0.05). These findings indicate that cabergoline treatment led to a significant and rapid reduction in serum prolactin concentrations and tumor size in patients with giant prolactinoma. Therefore, cabergoline represents an effective and well-tolerated treatment for invasive giant prolactinoma. INTRODUCTION Prolactinoma is the most common functioning pituitary adenoma with excellent medical response. Invasive giant prolactinoma, an extreme subset of prolactinoma, is characterized by large size (>40 mm in diameter), high aggressiveness, massive extrasellar involvement and very high plasma prolactin levels, usually >1,000 ng/mL. Although microprolactinoma is found predominantly in young female patients, invasive giant prolactinoma is prevalent in young male patients. Patients with giant prolactinoma usually present with symptoms or signs caused by the compression of surrounding structures by large or invasive tumors, including headache, visual disturbance, and/or diplopia. Many patients also have symptoms or signs of hypopituitarism, including hypogonadism. Dopamine agonists are used in the first line treatment for prolactinoma. Surgery is indicated for patients non-responsive or intolerant to dopamine agonists, as well as in patients with invasive macroadenomas and compromised vision who do not rapidly improve after medical treatment. Although the dopamine agonist bromocriptine has been widely used in patients with prolactinoma, the more recently developed dopamine agonist cabergoline is longer-acting and more selective for the dopamine type 2 (D2)-receptor. Moreover, cabergoline has been found to be more effective and better tolerated than bromocriptine in normalizing prolactin levels and shrinking tumors in both men and women. Here we report 10 cases of invasive giant prolactinoma, which were successfully treated with cabergoline alone. Patients The present study included all patients, who were diagnosed with invasive giant prolactinoma at the pituitary clinic of Asan Medical Center between April 2003 and June 2007 and treated only with cabergoline. All met the criteria for Efficacy and Safety of Cabergoline as First Line Treatment for Invasive Giant Prolactinoma Although cabergoline is effective in the treatment of micro-and macro-prolactinoma, little is known about its efficacy in the treatment of invasive giant prolactinoma. We investigated the efficacy and safety of cabergoline in 10 male patients with invasive giant prolactinoma. Before treatment, mean serum prolactin level was 11,426 ng/mL (range, 1,450-33,200 ng/mL) and mean maximum tumor diameter was 51 mm (range, 40-77 mm). Three months after initiation of cabergoline treatment, serum prolactin concentrations decreased more than 97% in 9 patients; at last follow-up (mean treatment duration, 19 months), the mean decrease in serum prolactin concentrations was 98%, with 5 patients having normal serum prolactin levels. At first MRI follow-up (3-12 months after initiation of cabergoline), the mean reduction in tumor size was 85±4% (range, 57-98%). Cabergoline treatment for more than 12 months caused a greater reduction in tumor size compared to the treatment for less than 12 months (97±1% vs. 78±7%, P<0.05). These findings indicate that cabergoline treatment led to a significant and rapid reduction in serum prolactin concentrations and tumor size in patients with giant prolactinoma. Therefore, cabergoline represents an effective and well-tolerated treatment for invasive giant prolactinoma. invasive giant prolactinomas: tumor diameter >40 mm, serum prolactin concentrations >1,000 ng/mL, and invasive extrasellar tumor growth. None of these patients had undergone surgery or radiotherapy for prolactinoma and none had a history of treatment with dopamine agonists. This study was performed retrospectively and approved by the ethical review board of Asan Medical Center. All individuals agreed to participate in the study and gave informed consent. Treatment protocol All patients received oral cabergoline at a starting dose of 0.5 mg once weekly. Based on serum prolactin concentrations, the dose of cabergoline was increased 0.5 mg/week every 3 to 6 months, to a maximum dose of 1.5 mg twice per week (total 3 mg per week). During treatment, all patients visited the clinic every 3 months, at which time serum prolactin concentrations were monitored. All patients were asked to report any side effects. Other pituitary function tests were performed before and during treatment, if warranted. Change in tumor size was monitored using sellar magnetic resonance imaging (MRI). Hormone assays Serum prolactin levels were measured by an immunoradiometric assay using commercial kits (TFB, Tokyo, Japan). The lowest detectible level of serum prolactin is 1.0 ng/mL, and its intra-and inter-assay coefficients of variation for prolactin concentrations were 7.1% and 3.6% respectively. The reference prolactin levels for men are 1.5-9.7 ng/mL. If serum prolactin levels were over 300 ng/mL, serum were serially diluted and subjected to remeasurement. Serum total testosterone concentrations were determined by radioimmunoassay (Adaltis Italia S.P.A., Italy) and the reference levels for testosterone are 2.8-8.8 ng/mL. Magnetic resonance imaging Pituitary tumor volume was evaluated using 0.5 or 1.5 T MRI scanners in the sagittal, coronal, and axial planes before and after gadolinium administration. Pituitary tumor volume was calculated from the major transverse, antero-posterior and cranio-caudal diameters. Pituitary tumor shrinkage was evaluated by the percentage reduction in tumor volume. Statistical analysis Results are expressed as mean±S.E.M. Treatment-associated changes in tumor-related parameters were statistically analyzed using paired Student's t-test (version 15; SPSS, Chicago, IL, U.S.A.). P<0.05 was considered statistically significant. RESULTS During the study period, 10 male patients were diagnosed with invasive giant prolactinoma; at diagnosis, mean age was 37±4 yr (range, 25-59 yr). Of these 10 patients, 4 had visual field defects and headache and 3 had only headache. One patient (No. 10) had nasal obstruction and bleeding, which resulted from a tumor growing downward to the infrasellar area. The remaining two patients had no symptoms; their tumors were accidentally found during routine checkup of brain MRI or CT. Seven patients had low serum testosterone concentrations (<2.8 ng/mL), and one (No. 2) had panhypopituitarism at diagnosis. Before treatment, mean serum prolactin concentration was 11,426 ng/mL (range, 1,450-33,200 g/mL) and mean maximal tumor diameter was 51 mm (range, 40-77 mm). Seven patients received 0.5-1 mg cabergoline per week with no dose increment throughout the treatment period. The dose of cabergoline was increased to 2 mg per week in 2 patients (Nos. 7 and 10) and to 3 mg per week in one patient (No. 6). Fig. 1). In all patients except one (No. 7), serum prolactin concentration was reduced by 97% after 3 months of treatment. At the last follow-up, average serum prolactin levels were decreased by 98%, with 6 of the 10 patients having serum prolactin concentrations <20 ng/mL. Patient No. 7, who experienced only a 33% decrease at 3 months due to irregular medication, showed an 89% decrease in serum prolactin concentration after 9 months of treatment. These findings indicate that cabergoline treatment was very effective in reducing serum prolactin levels in all patients with invasive giant prolactinoma. When we analyzed changes in tumor size during cabergoline treatment, we observed a significant reduction (mean, 85±4%; range, 57-98%) at first MRI follow-up, performed after 3 to 12 months of treatment (Table 2, Fig. 2). Except for Patient No. 7, all patients showed a significant decrease in tumor size within 6 months of treatment (mean, 86±3%; range, 70-90%). A further reduction in tumor size was observed with a longer duration of cabergoline treatment. Cabergoline treatment for >12 months caused a greater reduction in tumor size compared with the treatment for <12 months (97±1% vs. 78±7%, P<0.05), indicating that long-term cabergoline treatment was very efficient for reduction of tumor size in giant prolactinoma. During treatment, three patients showed improvements in visual field defects. Serum testosterone concentrations returned to the normal level in three of seven patients who had initially hypogonadism (mean testosterone levels; 1.2 to 4.0 ng/mL). There was no further decrease in other pituitary hormones during cabergoline treatment (data not shown). Duration of treatment (months) DISCUSSION In the present study, the patients with invasive giant prolactinoma were all males. Prolactinomas in males are known to be more invasive and growing more rapidly, suggesting that male prevalence of large prolactinoma may be due to its aggressive nature, not merely due to delayed diagnosis. The extreme aggressive type of macroprolactinoma is invasive giant prolactinoma. A previous study reported that long-term cabergoline treatment (mean duration, 15 months) in males and females with macroprolactinoma resulted in a 61% prolactin normalization rate and a 66% tumor shrinkage rate. Similarly, in another study, the rate of prolactin normalization was approximately 75% in males with macroprolactinoma following 24 months of cabergoline treatment. There were two previous studies showing the outcomes of cabergoline treatment in giant prolactinoma. In one study, cabergoline treatment normalized prolactin concentrations in 5 of 10 men with giant prolactinoma. Furthermore, in the remaining five patients, serum prolactin levels were decreased by 94% of the pretreatment levels after a mean 39 months of cabergoline therapy. In the other study, cabergoline treatment for 1-50 months normalized prolactin levels in eight out of ten patients with giant prolactinoma. Consistent with the previous reports, our study showed that cabergoline induced a profound reduction (>95%) in serum prolactin levels within 3 months in 7 among 10 patients. At last follow-up (average treatment duration, 19 months), serum prolactin levels were decreased to 2% of basal levels in all 10 patients and normalized in 5 patients. Tumor shrinkage was significant (86% reduction) within 6 months although a further decrease (97%) in tumor size was observed after >12 months of cabergoline treatment. Compared to the previous reports, our data showed that lower dose (0.5-1 mg/week) of cabergoline treatment induced more rapid decreases in both serum prolactin levels and tumor volume. The reason for the excellent outcome in our patients is unclear. However, it may result from that our study included the patients with more aggressive prolactinoma as suggested by larger tumor size and higher basal prolactin levels. When we reviewed the outcome of bromocriptine treatment in giant prolactinoma, bromocriptine treatment for more than 5 yr caused an overall 99.8% decrease in prolactin levels and a mean 68% decrease in tumor volume. Although outcomes of bromocriptine treatment are comparable to those of cabergoline, some patients are intolerant to bromocriptine due to side effects such as nausea, orthostatic dizziness, fatigue and nasal congestion. In our study, none of the patients experienced any adverse effects during cabergoline treatment, and none experienced disturbances in the other pituitary functions or cerebrospinal fluid rhinorrhea, a rare complication of dopamine agonist treatment. Thus cabergoline treatment is safe and well-tolerated. Complete surgical removal of giant prolactinomas via the transsphenoidal approach is very difficult because these tumors invade local surrounding structures, including the cavernous sinus and optic chiasm. Therefore, the persistence and recurrence of giant prolactinoma after surgery are very high. Biochemical cure is also rare even after extensive tumor removal. Indeed, during the same study period, nine patients were diagnosed with invasive giant prolactinoma but underwent transsphenoidal tumor resection before a referral to our department. Although serum prolactin concentrations were significantly decreased by surgery (from 2,655±474 to 381 ±187 ng/mL), normalization of serum prolactin levels or complete tumor resection was not achieved by surgery in all patients (unpublished data), requiring additional medical treatment. Our study has limitations; it was a retrospective and noncontrolled study with small number of patients. However, our data indicate that cabergoline treatment is a safe and effective treatment in male patients with invasive giant prolactinomas.
/** * Test of setDefaultCovariance method, of class gov.sandia.isrc.learning.vector.NeighborhoodGaussianClusterInitializer. */ public void testSetDefaultCovariance() { System.out.println("setDefaultCovariance"); NeighborhoodGaussianClusterInitializer instance = new NeighborhoodGaussianClusterInitializer( random ); double change = random.nextDouble(); instance.setDefaultCovariance( change ); assertEquals( change, instance.getDefaultCovariance() ); }
Election Day: Local dimwit John Thurpwood was guilt-tripped by his Facebook friends into visiting his designated polling place and voting in the US presidential election today, despite not knowing anything about the candidates or their positions on various political issues. “I wasn’t really going to vote since I’m not into politics and I didn’t watch any of the debates,” said Thurpwood. “Until I browsed my news feed and all my friends were going on and on about exercising our civil liberties and whatever and I felt kinda bad.” Thurpwood, who self-identifies as a “pop culture junkie,” couldn’t remember what political party his mom registered him for in 2008. “I figured I shouldn’t be voting since I don’t really follow any of this stuff and I’d rather make no decision at all than an uninformed decision. But then Paul Rudd tweeted a YouTube video of himself telling me to get out there and vote. How could I say no? He’s hilarious.” After browsing dozens of other PSAs featuring various celebrities, authority figures, and cute children telling him that it doesn’t matter who he votes for as long as he votes, Thurpwood changed his mind. “Ok, ok. I’ll vote. Wait, what’s Obama’s last name? Should I vote for him? Or Matt Romley? Our economy is bad, right? Which is the one who said he would make the economy better?” Upon exiting the polling booth, Thurpwood put on his “I voted!” pin, having proudly cast a vote for Dr. Jill Stein and Cheri Honkala of the Green Party because he thought they would legalize marijuana.
package org.se.lab.db.dao; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.se.lab.db.data.PrivateMessage; import org.se.lab.db.data.User; import java.util.List; public class PrivateMessageDAOTest extends AbstractDAOTest { private User user; private User user2; private PrivateMessage pm; private PrivateMessage pm2; private static PrivateMessageDAOImpl pmdao = new PrivateMessageDAOImpl(); private static UserDAOImpl udao = new UserDAOImpl(); static { pmdao.setEntityManager(em); udao.setEntityManager(em); } @Before @Override public void setup() { super.setup(); user = new User("User1", "test"); user2 = new User("User2", "test"); pm = new PrivateMessage("Hallo Textmessage Test 1", user, user2); pm2 = new PrivateMessage("Hallo Testmessage Test 2", user2, user); } @Test @Override public void testCreate() { PrivateMessage persisted = pmdao.insert(pm); Assert.assertEquals(pm, pmdao.findById(persisted.getID())); } @Test @Override public void testRemove() { PrivateMessage persisted = pmdao.insert(pm); pmdao.delete(persisted); Assert.assertNull(pmdao.findById(pm.getID())); } @Test public void testfindAll() { PrivateMessage persisted = pmdao.insert(pm); PrivateMessage persisted2 = pmdao.insert(pm2); List<PrivateMessage> pms = pmdao.findAll(); Assert.assertEquals(true, pms.contains(persisted)); Assert.assertEquals(true, pms.contains(persisted2)); } @Test public void testfindById() { PrivateMessage persisted = pmdao.insert(pm); Assert.assertEquals(persisted, pmdao.findById(persisted.getID())); } @Test @Override public void testModify() { PrivateMessage persisted = pmdao.insert(pm); persisted.setText("Blah"); Assert.assertEquals(persisted.getText(), pmdao.findById(persisted.getID()).getText()); } @After @Override public void tearDown(){ //arrange List<PrivateMessage> pms = pmdao.findAll(); //act if(pms.contains(pm)) pmdao.delete(pm); if(pms.contains(pm2)) pmdao.delete(pm2); //arrange List<User> testUsers = udao.findAll(); //act if(testUsers.contains(user)) udao.delete(user); if(testUsers.contains(user2)) udao.delete(user2); //assert pms = pmdao.findAll(); testUsers = udao.findAll(); Assert.assertEquals(false, pms.contains(pm)); Assert.assertEquals(false, pms.contains(pm2)); Assert.assertEquals(false, testUsers.contains(user)); Assert.assertEquals(false, testUsers.contains(user2)); super.tearDown(); } }
<reponame>kavin256/Derby /* * Derby - Class org.apache.derbyTesting.functionTests.util.TimeZoneTestSetup * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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. */ package org.apache.derbyTesting.junit; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.TimeZone; import junit.framework.Test; /** * Decorator that changes the default timezone of the runtime environment * for the duration of the test. */ public class TimeZoneTestSetup extends BaseTestSetup { /** Original timezone. */ private TimeZone savedDefault; /** The timezone to use as default while running the test. */ private TimeZone requestedDefault; /** * Wrap a test in a decorator that changes the default timezone. * @param test the test to decorate * @param timeZoneID the ID of the timezone to use */ public TimeZoneTestSetup(Test test, String timeZoneID) { this(test, TimeZone.getTimeZone(timeZoneID)); } /** * Wrap a test in a decorator that changes the default timezone. * @param test the test to decorate * @param zone the timezone to use */ public TimeZoneTestSetup(Test test, TimeZone zone) { super(test); this.requestedDefault = zone; } /** * Set the timezone. */ protected void setUp() { savedDefault = TimeZone.getDefault(); setDefault(requestedDefault); } /** * Reset the timezone. */ protected void tearDown() { setDefault(savedDefault); savedDefault = null; requestedDefault = null; } public static void setDefault(final TimeZone tz) { if (tz== null) { throw new IllegalArgumentException("tz cannot be <null>"); } AccessController.doPrivileged( new PrivilegedAction() { public Object run() throws SecurityException { TimeZone.setDefault(tz); return null; }}); } }
1. Field of the Invention This relates to packaged semiconductors and more particularly to packaged semiconductors with a die having multiple rows of bond pads that couple to a carrier of the die. 2. Related Art As geometries in semiconductors continue to shrink in size due to improvements in the technology for making semiconductors, the die sizes themselves often become smaller. As these die sizes become smaller the complexity of the integrated circuit does not decrease but may even increase. Thus, the number of pins required for the integrated circuit does not necessarily change and if the functionality actually increases then the number of pins is likely to increase as well. Thus, for a given functionality, the die size is becoming smaller or in the alternative, for a given die size, the functionality, and thus the pin out number, is getting greater. In either case, there is then a difficulty in efficiently achieving all of the pin outs to a user of the integrated circuit. The packaging technology that is common for complex integrated circuits requiring many pin outs is called Ball Grid Array (BGA). There may in fact be a pad limit for a given size of integrated circuit. If the number of pads (pin outs) exceeds the limit for a given die size, the integrated circuit is considered to be pad limited. One of the ways this is done is with wire bonding to the top surface of the package substrate with balls on the bottom surface and the integrated circuit being on the top surface and wire bonded to the top surface. Vias run from the top surface to the bottom surface and then traces run from the vias to the balls on the bottom and from bond fingers to vias on the top surface. It is desirable for the packaged substrate to be as small as possible, and it is also desirable for the integrated circuit to be as small as possible. In order to achieve the connections required between the integrated circuit and the top surface by way of the bond fingers, there must be enough space between the wires that run from the integrated circuit die to the bond fingers. One of the techniques for getting all of the connections made is to stagger the bond pads in two rows. This provides more space between the wires, however, there is still a limitation on how tightly spaced even the staggered ones can be. Further the staggering requires that the bond pads be further apart than the minimum that could be achieved based on the manufacturing capability. Thus the space required for the bond pads, due to staggering, is greater than the minimum space allowed for bond pads. Some techniques to try to improve the ability to provide the needed pin outs have included using cavity techniques on the substrate so that the bond fingers are on different levels. This substantially raises the cost of the substrate. Further, this may not provide for more than two rows even then. Thus, there is a need for the ability to provide wires between an integrated circuit and bond fingers on a package substrate in a manner that does not mandate a bond spacing greater than the minimum pitch requires and being able to provide the full number of pins required without having to increase the die size simply for the purpose of being able to achieve the needed wire bonding.
#include <bits/stdc++.h> using longlong=long long; int main(){ std::cin.tie(nullptr);std::cin.sync_with_stdio(false); int n,k;std::cin>>n>>k; int N=1<<n; int ans=std::numeric_limits<int>::max(); for(int bs=0;bs<N;bs++){ int x=1; for(int i=0;i<n;i++){ if(bs>>i&1)x*=2; else x+=k; } if(x<ans)ans=x; } std::cout<<ans<<std::endl; }
import { ArrayVector, DataTransformerConfig, DataTransformerID, FieldType, toDataFrame, transformDataFrame, } from '@grafana/data'; import { RenameFieldsTransformerOptions } from './rename'; describe('Rename Transformer', () => { describe('when consistent data is received', () => { const data = toDataFrame({ name: 'A', fields: [ { name: 'time', type: FieldType.time, values: [3000, 4000, 5000, 6000] }, { name: 'temperature', type: FieldType.number, values: [10.3, 10.4, 10.5, 10.6] }, { name: 'humidity', type: FieldType.number, values: [10000.3, 10000.4, 10000.5, 10000.6] }, ], }); it('should rename according to config', () => { const cfg: DataTransformerConfig<RenameFieldsTransformerOptions> = { id: DataTransformerID.rename, options: { renameByName: { time: 'Total time', humidity: 'Moistiness', temperature: 'how cold is it?', }, }, }; const renamed = transformDataFrame([cfg], [data])[0]; expect(renamed.fields).toEqual([ { config: {}, name: 'Total time', type: FieldType.time, values: new ArrayVector([3000, 4000, 5000, 6000]), }, { config: {}, name: 'how cold is it?', type: FieldType.number, values: new ArrayVector([10.3, 10.4, 10.5, 10.6]), }, { config: {}, name: 'Moistiness', type: FieldType.number, values: new ArrayVector([10000.3, 10000.4, 10000.5, 10000.6]), }, ]); }); }); describe('when inconsistent data is received', () => { const data = toDataFrame({ name: 'A', fields: [ { name: 'time', type: FieldType.time, values: [3000, 4000, 5000, 6000] }, { name: 'pressure', type: FieldType.number, values: [10.3, 10.4, 10.5, 10.6] }, { name: 'humidity', type: FieldType.number, values: [10000.3, 10000.4, 10000.5, 10000.6] }, ], }); it('should not rename fields missing in config', () => { const cfg: DataTransformerConfig<RenameFieldsTransformerOptions> = { id: DataTransformerID.rename, options: { renameByName: { time: 'ttl', temperature: 'temp', humidity: 'hum', }, }, }; const renamed = transformDataFrame([cfg], [data])[0]; expect(renamed.fields).toEqual([ { config: {}, name: 'ttl', type: FieldType.time, values: new ArrayVector([3000, 4000, 5000, 6000]), }, { config: {}, name: 'pressure', type: FieldType.number, values: new ArrayVector([10.3, 10.4, 10.5, 10.6]), }, { config: {}, name: 'hum', type: FieldType.number, values: new ArrayVector([10000.3, 10000.4, 10000.5, 10000.6]), }, ]); }); }); describe('when transforming with empty configuration', () => { const data = toDataFrame({ name: 'A', fields: [ { name: 'time', type: FieldType.time, values: [3000, 4000, 5000, 6000] }, { name: 'pressure', type: FieldType.number, values: [10.3, 10.4, 10.5, 10.6] }, { name: 'humidity', type: FieldType.number, values: [10000.3, 10000.4, 10000.5, 10000.6] }, ], }); it('should keep the same names as in the incoming data', () => { const cfg: DataTransformerConfig<RenameFieldsTransformerOptions> = { id: DataTransformerID.rename, options: { renameByName: {}, }, }; const renamed = transformDataFrame([cfg], [data])[0]; expect(renamed.fields).toEqual([ { config: {}, name: 'time', type: FieldType.time, values: new ArrayVector([3000, 4000, 5000, 6000]), }, { config: {}, name: 'pressure', type: FieldType.number, values: new ArrayVector([10.3, 10.4, 10.5, 10.6]), }, { config: {}, name: 'humidity', type: FieldType.number, values: new ArrayVector([10000.3, 10000.4, 10000.5, 10000.6]), }, ]); }); }); });
Parents in Leeds have been warned that they will be handed a hefty fine if they park on school zig-zag lines. West Yorkshire Police issued a stark warning to parents that they will not tolerate those who park on the lines outside schools. A spokesman for the force said: "It has become apparent that some people are parking inconsiderately on school zig-zags, yellow lines, causing obstructions and blocking driveways. "I would ask those dropping or picking children up from school to park their vehicles in a safe and appropriate manner. Please park responsibly for the safety of your own children and others. "Local PCSOs will be increasing patrols and taking action where necessary. Fixed Penalty Tickets may be issued to those who continue to park irresponsibly and illegally. "Thank you for your support" Those who park on zig-zag lines outside schools face an on the spot fine of up to £100.
<reponame>Maxim98/BusinessAnalysis #include "data_provider.h" #include "base/logger/logger.h" #include "base/csv_parser/csv_parser.h" #include <iostream> namespace { std::string Strip(const std::string& s, const std::string& chars = "\" ") { const auto first = s.find_first_not_of(chars); const auto last = s.find_last_not_of(chars); if (first == std::string::npos) return ""; return s.substr(s.find_first_not_of(chars), last - first); } }; DataProvider::DataProvider(const std::vector<DataSource>& sources) { for (const auto& source : sources) { add_source(source); } } void DataProvider::add_source(const DataSource& source) { DEBUG("add source: filename: " << source.first << " company_names_row: " << source.second) sources_.push_back(source); } std::vector<std::string> DataProvider::company_names() const { std::vector<std::string> result; for (const auto& source : sources_) { DEBUG("try extract company_names from file: " << source.first) auto companies = company_names_from_csv(source); result.insert(result.end(), companies.begin(), companies.end()); } return result; } std::vector<std::string> DataProvider::company_names_from_csv( const DataSource& source) const { CsvParser csv_parser(source.first); return company_names(csv_parser.items(), source.second); } std::vector<std::string> DataProvider::company_names( const std::vector<std::unordered_map<std::string, std::string>>& items, const std::string& company_names_row ) const { std::vector<std::string> company_names; company_names.reserve(items.size()); for (const auto& item : items) { company_names.push_back(Strip(item.at(company_names_row))); } return company_names; }
package tcp import ( "fmt" "log" "math/rand" "time" "github.com/hedwig100/go-network/pkg/ip" "github.com/hedwig100/go-network/pkg/utils" ) func Init(done chan struct{}) error { go tcpTimer(done) rand.Seed(time.Now().UnixNano()) return ip.ProtoRegister(&Proto{}) } type segment struct { seq uint32 ack uint32 len uint32 wnd uint16 up uint16 } /* TCP Protocol */ // Proto is struct for TCP protocol handler. // This implements IPUpperProtocol interface. type Proto struct{} func (p *Proto) Type() ip.ProtoType { return ip.ProtoTCP } func (p *Proto) RxHandler(data []byte, src ip.Addr, dst ip.Addr, ipIface *ip.Iface) error { hdr, payload, err := data2header(data, src, dst) // TODO: // have to treat header part of payload (payload may have header because we cut data with-HeaderSizeMin) if err != nil { return err } // search TCP pcb var pcb *pcb for _, candidate := range pcbs { if candidate.local.Addr == dst && candidate.local.Port == hdr.Dst { pcb = candidate break } } if pcb == nil { return fmt.Errorf("TCP socket whose address is %s:%d not found", dst, hdr.Dst) } hdrLen := (hdr.Offset >> 4) << 2 dataLen := uint32(len(data)) - uint32(hdrLen) log.Printf("[D] TCP rxHandler: src=%s:%d,dst=%s:%d,iface=%s,len=%d,tcp header=%s,payload=%v", src, hdr.Src, dst, hdr.Dst, ipIface.Family(), dataLen, hdr, payload) // segment seg := segment{ seq: hdr.Seq, ack: hdr.Ack, len: dataLen, wnd: hdr.Window, up: hdr.Urgent, } if isSet(hdr.Flag, SYN|FIN) { seg.len++ } foreign := Endpoint{ Addr: src, Port: hdr.Src, } return segmentArrives(pcb, seg, hdr.Flag, payload[hdrLen-HeaderSizeMin:], dataLen, foreign) } func segmentArrives(pcb *pcb, seg segment, flag ControlFlag, data []byte, dataLen uint32, foreign Endpoint) error { mutex.Lock() defer mutex.Unlock() switch pcb.state { case PCBStateClosed: if isSet(flag, RST) { // An incoming segment containing a RST is discarded return nil } // ACK bit is off if !isSet(flag, ACK) { return TxHandler(pcb.local, pcb.foreign, []byte{}, 0, seg.seq+seg.len, RST|ACK, 0, 0) } // ACK bit is on return TxHandler(pcb.local, pcb.foreign, []byte{}, seg.ack, 0, RST, 0, 0) case PCBStateListen: // first check for an RST if isSet(flag, RST) { // An incoming RST should be ignored return nil } // second check for an ACK if isSet(flag, ACK) { // Any acknowledgment is bad if it arrives on a connection still in the LISTEN state. // An acceptable reset segment should be formed for any arriving ACK-bearing segment. return TxHandler(pcb.local, pcb.foreign, []byte{}, seg.ack, 0, RST, 0, 0) } // third check for a SYN if isSet(flag, SYN) { // ignore security check pcb.foreign = foreign pcb.rcv.wnd = bufferSize pcb.rcv.nxt = seg.seq + 1 pcb.irs = seg.seq pcb.iss = createISS() pcb.snd.nxt = pcb.iss + 1 pcb.snd.una = pcb.iss pcb.foreign = foreign pcb.transition(PCBStateSYNReceived) copy(pcb.rxQueue[pcb.rxLen:], data) pcb.rxLen += uint16(dataLen) return TxHelperTCP(pcb, SYN|ACK, []byte{}, 0, nil) } // fourth other text or control log.Printf("[D] TCP segment discarded") return nil case PCBStateSYNSent: // first check the ACK bit var acceptable bool if isSet(flag, ACK) { // If SEG.ACK =< ISS, or SEG.ACK > SND.NXT, send a reset (unless // the RST bit is set, if so drop the segment and return) if seg.ack <= pcb.iss || seg.ack > pcb.snd.nxt { return TxHandler(pcb.local, pcb.foreign, []byte{}, seg.ack, 0, RST, 0, 0) } if pcb.snd.una <= seg.ack && seg.ack <= pcb.snd.nxt { // this ACK is acceptable acceptable = true } } // second check the RST bit if isSet(flag, RST) { if acceptable { pcb.signalErr("connection reset") pcb.transition(PCBStateClosed) return nil } log.Printf("[D] TCP segment discarded") return nil } // third check the security and precedence // ignore // fourth check the SYN bit if isSet(flag, SYN) { pcb.rcv.nxt = seg.seq + 1 pcb.irs = seg.seq if acceptable { // our SYN has been ACKed pcb.snd.una = seg.ack pcb.queueAck() } if pcb.snd.una > pcb.iss { pcb.transition(PCBStateEstablished) pcb.snd.wnd = seg.wnd pcb.snd.wl1 = seg.seq pcb.snd.wl2 = seg.ack // notify user call OPEN pcb.signalCmd(triggerOpen) return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) } else { pcb.transition(PCBStateSYNReceived) // TODO: // If there are other controls or text in the // segment, queue them for processing after the ESTABLISHED state // has been reached return TxHelperTCP(pcb, SYN|ACK, []byte{}, 0, nil) } } // fifth, if neither of the SYN or RST bits is set then drop the segment and return. log.Printf("[D] TCP segment discarded") return nil default: // first check sequence number var acceptable bool if pcb.rcv.wnd == 0 { if seg.len == 0 && seg.seq == pcb.rcv.nxt { acceptable = true } if seg.len > 0 { acceptable = false } } else { if seg.len == 0 && (pcb.rcv.nxt <= seg.seq && seg.seq < pcb.rcv.nxt+uint32(pcb.rcv.wnd)) { acceptable = true } if seg.len > 0 && (pcb.rcv.nxt <= seg.seq && seg.seq < pcb.rcv.nxt+uint32(pcb.rcv.wnd)) || (pcb.rcv.nxt <= seg.seq+seg.len-1 && seg.seq+seg.len-1 < pcb.rcv.nxt+uint32(pcb.rcv.wnd)) { acceptable = true } } if !acceptable { if isSet(flag, RST) { return nil } log.Printf("[E] ACK number is not acceptable") return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) } // TODO: // In the following it is assumed that the segment is the idealized // segment that begins at RCV.NXT and does not exceed the window. // One could tailor actual segments to fit this assumption by // trimming off any portions that lie outside the window (including // SYN and FIN), and only processing further if the segment then // begins at RCV.NXT. Segments with higher begining sequence // numbers may be held for later processing. // // right := min(pcb.rcv.nxt+uint32(pcb.rcv.wnd)-seg.seq, dataLen) // data = data[pcb.rcv.nxt-seg.seq : right] // second check the RST bit switch pcb.state { case PCBStateSYNReceived: if isSet(flag, RST) { // If this connection was initiated with an active OPEN (i.e., came // from SYN-SENT state) then the connection was refused, signal // the user "connection refused". pcb.signalErr("connection refused") pcb.transition(PCBStateClosed) return nil } case PCBStateEstablished, PCBStateFINWait1, PCBStateFINWait2, PCBStateCloseWait: if isSet(flag, RST) { // any outstanding RECEIVEs and SEND should receive "reset" responses // Users should also receive an unsolicited general "connection reset" signal pcb.signalErr("connection reset") pcb.transition(PCBStateClosed) return nil } case PCBStateClosing, PCBStateLastACK, PCBStateTimeWait: if isSet(flag, RST) { pcb.signalErr("connection reset") pcb.transition(PCBStateClosed) return nil } } // third check security and precedence // ignore // fourth, check the SYN bit switch pcb.state { case PCBStateSYNReceived, PCBStateEstablished, PCBStateFINWait1, PCBStateFINWait2, PCBStateCloseWait, PCBStateClosing, PCBStateLastACK, PCBStateTimeWait: if isSet(flag, SYN) { // any outstanding RECEIVEs and SEND should receive "reset" responses, // all segment queues should be flushed, the user should also // receive an unsolicited general "connection reset" signal pcb.signalErr("connection reset") pcb.transition(PCBStateClosed) return TxHelperTCP(pcb, RST, []byte{}, 0, nil) } } // fifth check the ACK field if !isSet(flag, ACK) { log.Printf("[D] TCP segment discarded") return nil } switch pcb.state { case PCBStateSYNReceived: if pcb.snd.una <= seg.ack && seg.ack <= pcb.snd.nxt { pcb.transition(PCBStateEstablished) } else { log.Printf("unacceptable ACK is sent") return TxHandler(pcb.local, pcb.foreign, []byte{}, seg.ack, 0, RST, 0, 0) } fallthrough case PCBStateEstablished, PCBStateFINWait1, PCBStateFINWait2, PCBStateCloseWait, PCBStateClosing: if pcb.snd.una < seg.ack && seg.ack <= pcb.snd.nxt { pcb.snd.una = seg.ack // Users should receive // positive acknowledgments for buffers which have been SENT and // fully acknowledged (i.e., SEND buffer should be returned with // "ok" response) // in removeQueue function pcb.queueAck() // Note that SND.WND is an offset from SND.UNA, that SND.WL1 // records the sequence number of the last segment used to update // SND.WND, and that SND.WL2 records the acknowledgment number of // the last segment used to update SND.WND. The check here // prevents using old segments to update the window. if pcb.snd.wl1 < seg.seq || (pcb.snd.wl1 == seg.seq && pcb.snd.wl2 <= seg.ack) { pcb.snd.wnd = seg.wnd pcb.snd.wl1 = seg.seq pcb.snd.wl2 = seg.ack } } else if seg.ack < pcb.snd.una { // If the ACK is a duplicate (SEG.ACK < SND.UNA), it can be ignored. } else if seg.ack > pcb.snd.nxt { // ?? // If the ACK acks something not yet sent (SEG.ACK > SND.NXT) then send an ACK, drop the segment, and return. return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) } switch pcb.state { case PCBStateFINWait1: // In addition to the processing for the ESTABLISHED state, // if our FIN is now acknowledged then enter FIN-WAIT-2 and continue processing in that state. if seg.ack == pcb.snd.nxt { pcb.transition(PCBStateFINWait2) } case PCBStateFINWait2: // if the retransmission queue is empty, the user’s CLOSE can be // acknowledged ("ok") if len(pcb.retxQueue) == 0 { pcb.signalCmd(triggerClose) } case PCBStateEstablished, PCBStateCloseWait: // Do the same processing as for the ESTABLISHED state. case PCBStateClosing: // In addition to the processing for the ESTABLISHED state, // if the ACK acknowledges our FIN then enter the TIME-WAIT state, otherwise ignore the segment. if seg.ack == pcb.snd.nxt { pcb.transition(PCBStateTimeWait) pcb.lastTxTime = time.Now() } } case PCBStateLastACK: // The only thing that can arrive in this state is an // acknowledgment of our FIN. If our FIN is now acknowledged, // delete the TCB, enter the CLOSED state, and return. if seg.ack == pcb.snd.nxt { pcb.signalErr("connection closed") pcb.transition(PCBStateClosed) } return nil case PCBStateTimeWait: // The only thing that can arrive in this state is a // retransmission of the remote FIN. Acknowledge it, and restart // the 2 MSL timeout. if isSet(flag, FIN) { pcb.lastTxTime = time.Now() } return nil } // sixth, check the URG bit, switch pcb.state { case PCBStateEstablished, PCBStateFINWait1, PCBStateFINWait2: if isSet(flag, RST) { pcb.rcv.up = utils.Max(pcb.rcv.up, seg.up) // TODO: // signal the user that the remote side has urgent data if the urgent // pointer (RCV.UP) is in advance of the data consumed. If the // user has already been signaled (or is still in the "urgent // mode") for this continuous sequence of urgent data, do not // signal the user again. } case PCBStateCloseWait, PCBStateClosing, PCBStateLastACK, PCBStateTimeWait: // ignore } // seventh, process the segment text switch pcb.state { case PCBStateEstablished, PCBStateFINWait1, PCBStateFINWait2: // Once in the ESTABLISHED state, it is possible to deliver segment // text to user RECEIVE buffers. Text from segments can be moved // into buffers until either the buffer is full or the segment is // empty. If the segment empties and carries an PUSH flag, then // the user is informed, when the buffer is returned, that a PUSH // has been received. if dataLen > 0 { copy(pcb.rxQueue[pcb.rxLen:], data) pcb.rxLen += uint16(dataLen) pcb.rcv.nxt = seg.seq + seg.len pcb.rcv.wnd -= uint16(dataLen) pcb.signalCmd(triggerReceive) // TODO: // This acknowledgment should be piggybacked on a segment being // transmitted if possible without incurring undue delay. return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) } case PCBStateCloseWait, PCBStateClosing, PCBStateLastACK, PCBStateTimeWait: // ignore } // eighth, check the FIN bit, switch pcb.state { case PCBStateClosed, PCBStateListen, PCBStateSYNSent: // drop the segment and return. return nil default: } if isSet(flag, FIN) { // FIN bit is set // signal the user "connection closing" and return any pending RECEIVEs with same message, pcb.signalCmd(triggerReceive) pcb.rcv.nxt = seg.seq + 1 switch pcb.state { case PCBStateSYNReceived, PCBStateEstablished: pcb.transition(PCBStateCloseWait) return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) case PCBStateFINWait1: if seg.ack == pcb.snd.nxt { pcb.transition(PCBStateTimeWait) // time-wait timer, turn off the other timers pcb.lastTxTime = time.Now() } else { pcb.transition(PCBStateClosing) } return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) case PCBStateFINWait2: pcb.transition(PCBStateTimeWait) // time-wait timer, turn off the other timers pcb.lastTxTime = time.Now() return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) case PCBStateCloseWait, PCBStateClosing, PCBStateLastACK: // remain return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) case PCBStateTimeWait: // Restart the 2 MSL time-wait timeout. pcb.lastTxTime = time.Now() return TxHelperTCP(pcb, ACK, []byte{}, 0, nil) } } } return nil } func TxHelperTCP(pcb *pcb, flag ControlFlag, data []byte, trigger uint8, errCh chan error) error { seq := pcb.snd.nxt if isSet(flag, SYN) { seq = pcb.iss } if err := TxHandler(pcb.local, pcb.foreign, data, seq, pcb.rcv.nxt, flag, pcb.rcv.wnd, pcb.rcv.up); err != nil { return err } if isSet(flag, SYN|FIN) || len(data) > 0 { pcb.queueAdd(seq, flag, data, trigger, errCh) } return nil } func TxHandler(src Endpoint, dst Endpoint, payload []byte, seq uint32, ack uint32, flag ControlFlag, wnd uint16, up uint16) error { if len(payload)-HeaderSizeMin > ip.PayloadSizeMax { return fmt.Errorf("data size is too large for TCP payload") } // transform TCP header to byte strings hdr := Header{ Src: src.Port, Dst: dst.Port, Seq: seq, Ack: ack, Offset: (HeaderSizeMin >> 2) << 4, Flag: flag, Window: wnd, Urgent: up, } data, err := header2data(&hdr, payload, src.Addr, dst.Addr) if err != nil { return err } log.Printf("[D] TCP TxHandler: src=%s,dst=%s,len=%d,tcp header=%s", src, dst, len(payload), hdr) return ip.TxHandler(ip.ProtoTCP, data, src.Addr, dst.Addr) }
Destination Therapy: Safety and Feasibility of National and International Travel Results for Destination Therapy (DT) continue to improve with advanced technology, better patient selection, and experienced clinical management. Quality of life for these patients is an important component of the overall success of DT, and traveling is becoming more common. We reviewed our experience with long-distance travel in our DT population. All patients implanted with a left ventricular assist device for DT were followed prospectively. Long-distance travel was considered to be >200 miles, one way from their homes. There were 15 patients (14 men) with an average age of 66 years (range, 3082) who traveled a combined total of 40 long-distance trips. Four trips were international (Spain, Canada, and Puerto Rico), 35 within the continental U.S., and one to Hawaii. The average one way distance traveled was 925 miles with a range of 2184256 miles. The average time away from home was 8.3 days (range, 230). Patients traveled by airplane, car, and one trip included a 5 day cruise. Five complications occurred: driveline trauma, delay of reentry into the United States, missed flight, red heart alarm from bearing wear, and dehydration. All patients returned home safely for routine follow-up. Long-distance travel is possible for DT patients. Anticipating potential problems and careful planning is necessary for safe national and international travel.
/* * Copyright 2019 Google Inc. * * 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. */ package com.google.sps.recommendations; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.api.datastore.Entity; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; import org.ejml.simple.SimpleMatrix; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Recommender { private static Logger log = LoggerFactory.getLogger(Recommender.class); private int K; private final int STEPS = 10000; private final double ALPHA_START = 0.1; private final double BETA = 0.02; private final double DELTA = 0.01; private List<String> itemIndexMapping; private Map<Integer, String> userIDIndexMapping; /** * Recommender constructor with a custom number of latent features. * * @param k Number of latent features to use in matrix factorization */ public Recommender(int k) { K = k; } /** * Recommender constructor with default 2 latent features. */ public Recommender() { this(2); } /** * Generates recommendations from given datastore entries for the given user. * * @param datastore Datastore instance * @param stemmedListName stemmed name of the list * @param entities List of fractional aggregate entities containing all entities except the * current user's in the database. * @param uniqueItems Set of all unique property items in all entities. * @return List of Pairs where each pair contains the item name and the expected frequency that * the user would add an item to their list. */ public void makeRecommendations( DatastoreService datastore, String stemmedListName, List<Entity> entities, Set<String> uniqueItems) throws IllegalStateException { SimpleMatrix dataMatrix = createMatrixFromDatabaseEntities(entities, uniqueItems); SimpleMatrix userFeatures = SimpleMatrix.random_DDRM​(dataMatrix.numRows(), K, -2.0, 2.0, new Random(1)); SimpleMatrix itemFeatures = SimpleMatrix.random_DDRM​(K, dataMatrix.numCols(), -2.0, 2.0, new Random(1)); SimpleMatrix predictedResults = matrixFactorization(dataMatrix, userFeatures, itemFeatures); savePredictions(datastore, stemmedListName, predictedResults); } /** * Converts database entities into fully populated data matrix. * * @param userEntity Fractional aggregate entity of the current user * @param entities List of fractional aggregate entities containing all entities except the * current user's in the database. * @param uniqueItems Set of all unique property items in all entities. * @return Matrix containing values for each user as rows, items as columns, and fractional number * of times an item has appeared on the user's list as values. 0.0 if user never listed an * item. */ SimpleMatrix createMatrixFromDatabaseEntities(List<Entity> entities, Set<String> uniqueItems) { itemIndexMapping = new ArrayList<String>(uniqueItems); userIDIndexMapping = new HashMap<>(); Collections.sort(itemIndexMapping); double[][] userItemData = new double[entities.size()][uniqueItems.size()]; for (int i = 0; i < entities.size(); i++) { addEntity(userItemData, entities.get(i), i); } return new SimpleMatrix(userItemData); } /** * Adds a single entity to a row of the data array. * * @param userItemData double array containing unfilled matrix values * @param e Entity to fill the given row of the matrix * @param row The row to be for corresponding entity. */ private void addEntity(double[][] userItemData, Entity e, int row) { userIDIndexMapping.put(row, (String) e.getProperty("userID")); for (String item : e.getProperties().keySet()) { if (DatabaseUtils.AGG_ENTITY_ID_PROPERTIES.contains(item)) { continue; } userItemData[row][itemIndexMapping.indexOf(item)] = (double) e.getProperty(item); } } /** * Uses matrix factorization to compute the predicted result matrix by continuously multiplying * userFeatures and itemFeatures matrices. Based on the error between feature matrix product and * given data matrix, it increments/adjusts the feature matrices and tries again until error * reaches threshold of 0.001 or STEPS iterations has been completed. * * @param dataMatrix Matrix with real data values for user list item history. * @param userFeatures Matrix with guesses for how much each user is affiliated with the K * features * @param itemFeatures Matrix with guesses for how much each item is affiliated with the K * features * @return Matrix with the final best prediction for userFeatures * itemFeatures */ SimpleMatrix matrixFactorization( SimpleMatrix dataMatrix, SimpleMatrix userFeatures, SimpleMatrix itemFeatures) throws IllegalStateException { log.info("Input matrix: " + dataMatrix); for (int step = 0; step < STEPS; step++) { double updatedLearningRate = Math.max(ALPHA_START / (Math.sqrt(step + 1)), 0.005); for (int row = 0; row < dataMatrix.numRows(); row++) { for (int col = 0; col < dataMatrix.numCols(); col++) { double element = dataMatrix.get(row, col); if (Math.abs(element - 0.0) > DELTA) { double error = element - userFeatures .extractVector(true, row) .dot(itemFeatures.extractVector(false, col)); for (int k = 0; k < K; k++) { double userFeatures_ik = userFeatures.get(row, k); double itemFeatures_kj = itemFeatures.get(k, col); userFeatures.set( row, k, increment(userFeatures_ik, itemFeatures_kj, error, updatedLearningRate)); itemFeatures.set( k, col, increment(itemFeatures_kj, userFeatures_ik, error, updatedLearningRate)); } } } } SimpleMatrix estimatedData = userFeatures.mult(itemFeatures); if (estimatedData.hasUncountable()) { log.error("Failure at step: " + step); log.error("User feature matrix: " + userFeatures); log.error("Item feature matrix: " + itemFeatures); throw new IllegalStateException("NaN error in matrix factorization."); } double totalError = 0.0; for (int row = 0; row < dataMatrix.numRows(); row++) { for (int col = 0; col < dataMatrix.numCols(); col++) { double element = dataMatrix.get(row, col); if (Math.abs(element - 0.0) > DELTA) { totalError += Math.pow( element - userFeatures .extractVector(true, row) .dot(itemFeatures.extractVector(false, col)), 2); for (int k = 0; k < K; k++) { totalError += (BETA / 2) * (Math.pow(userFeatures.get(row, k), 2) + Math.pow(itemFeatures.get(k, col), 2)); } } } } if (totalError < 0.001) { return estimatedData; } } log.info("Return matrix: " + userFeatures.mult(itemFeatures)); return userFeatures.mult(itemFeatures); } /** * Increments each element based on the error at that element. * * @param e1 The value being adjusted. * @param e2 Corresponding value in the other matrix * @param error Error between the product at this value and the real data matrix at the * corresponding value. * @param alpha Current alpha learning rate * @return Double representing the incremental adjustment for e1. */ private double increment(double e1, double e2, double error, double alpha) { return e1 + alpha * (2 * error * e2 - BETA * e1); } /** * Stores results of matrix factorization into database. * * @param datastore Datastore instance * @param stemmedListName Stemmed name of the list that predictions were calculated for * @param predictedResults Matrix result of matrix factorization. * @return List of Pairs where each pair contains the item name and the expected frequency that * the user would add an item to their list. */ private void savePredictions( DatastoreService datastore, String stemmedListName, SimpleMatrix predictedResults) { for (int i = 0; i < predictedResults.numRows(); i++) { Entity entity = new Entity("UserPredictions-" + stemmedListName, userIDIndexMapping.get(i)); for (int j = 0; j < itemIndexMapping.size(); j++) { entity.setProperty(itemIndexMapping.get(j), predictedResults.get(i, j)); } log.info("Stored prediction entity: " + entity); datastore.put(entity); } } }
Description of a new Tiger Snake (Colubridae, Telescopus) from south-western Africa. Telescopus finkeldeyi sp. nov. is described from western central to northern Namibia and south-western Angola. Its maximum size is less than that of the other three taxa occurring in southern Africa. It is further distinguished by its fairly variable colour pattern. Although the number of ventrals and the undivided anal scale are similar to that of T. beetzii, the presence of 19 scale rows around the middle differs from the 21 rows of T. beetzii.
// Copyright 2014 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. #include "chromecast/common/pref_names.h" namespace prefs { // Port on which to host the remote debugging server. A value of 0 indicates // that remote debugging is disabled. const char kRemoteDebuggingPort[] = "remote_debugging_port"; } // namespace prefs
import { createContext } from "react" import io from "socket.io-client" export const socket = io() export const SocketContext = createContext(socket) socket.on("connect", () => { socket.emit("hello") }) socket.on("broadcast", (data) => { console.info({ broadcast: data }) })
Are you ready for some warmer weather? Highs today should be near 50 degrees with temps at least remaining around the ‘average high’ for this time of the year through the weekend. There will be a small chance for some rain and some flurries on Saturday but the already small chance looks to continue to dry up as each new model run comes in. The average high temperature for this time of the year is 48 degrees. Three of the next seven days are forecast to hit that mark. First up will be today as our highs should get near and likely top 50 degrees. We have your high as 52 at the Indianapolis airport. Temperatures won’t be as warm over the weekend but still close to the average for this time of the year. Saturday highs will hit the mid-40s with clouds around. Light rain and flurries will be possible heading into Saturday evening. Overnight lows fall to the upper 20s to start our Sunday with a Sunday high of 47. Sunday should be dry with clear skies. The warmest days of the week will be on Monday and Tuesday with highs expected to hit the upper 50s to the low 60s. Winter is set to return as we head into the last part of your week. Highs on Wednesday will be in the mid to upper 30s. Some data suggests a monster rain/snow set-up develops and brings parts of the state either rain, snow or both. This is something new to last night’s run as the Euro was dry yesterday. Rain and or snow could potentially carry over into your Thursday. For now I have temperatures reflecting the likely dry conditions at this time for Thursday. Enjoy your day!
During the practice of an electric arc welding process, it is necessary, at the beginning of the welding operation, to establish an electric arc between a cathode and an anode. In general, establishing the electric arc, also called striking, can be carried out in two ways, namely by a short circuit or by use of high voltage. More precisely, striking of the short circuit type consists in placing the cathode and the anode in contact with each other. In this manner, there is created, upon establishing the short circuit, a current flow which heats two ends of the electrodes facing each other and there is then produced an electric arc upon progressive separation of the two electrodes from each other. This type of short circuit striking is used particularly for TIG (Tungsten Inert Gas) welding in which the cathode is constituted by a tungsten electrode and the anode is constituted by the piece to be welded. Similarly, short circuit striking is also used for MIG (Metal Inert Gas) welding in which the anode is a fusible wire and the cathode, again, is the piece to be welded. It is to be noted however that when the anode is a fusible wire, it is not necessary to move the end of the fusible wire away from the cathode, upon striking the arc, because the intensity of the current is generally sufficiently great to melt the end of said wire and thereby permit the arc to be struck. It is also possible to use striking by short circuit when practicing plasma cutting or in a process of surface treatment with an electric arc. However, striking by short circuit has a major disadvantage, namely, requiring contact between the cathode and the anode, said contact being apt to give rise to pollution or premature wear or the cathode, in particular, when the latter is a tungsten electrode, thus requiring its more frequent replacement. Accordingly, in TIG welding, striking by short circuit gives rise to a frequent regrinding of the tungsten electrode. Moreover, it has been noted that inclusions of tungsten were likely to be found in the weld bead, which is prejudicial and decreases the quality of said weld bead. These problems can at least in part be solved by striking of the high voltage type. Thus, this type of striking uses high voltage pulses and does not require direct contact between the anode, which is to say the piece to be TIG welded, and the cathode. However, for reasons of cost and safety, the generation of high voltage generally implies that each of the high voltage pulses in fact be a high voltage damped oscillation. The high voltage thus used effects a breakdown of the dielectric usually formed by the protective gas used, by rendering said dielectric electrically conductive and thereby permitting the passage of the current and the striking of an electric arc. The greater the distance between the cathode and the anode, the greater the amplitude of the high voltage necessary to establish the electric arc. The high voltage striking process is particularly used in TIG welding, in plasma cutting and in plasma welding. In this latter case, the arc is struck, first between two electrodes, then transferred to the piece to be welded by the plasmagenic gas flow. Sometimes high voltage striking is also used in MIG welding, in particular in MIG welding in which during each half-cycle the voltage is zero and the wire not being in contact with the material to be welded, it may be necessary to restrike the electric arc. However, high voltage striking also has itself a certain number of drawbacks. Thus, the use of high voltages generally gives rise to substantial electromagnetic noise adapted to disturb considerably the electromagnetic environment of the welder and whose level is subject to strict regulation. Thus, the level of disturbance is proportional to the electric power used during the striking phase of the electric arc and, no matter what the welding process which uses this high voltage striking, it is ordinarily necessary to minimize the amplitude of the high voltage necessary to establish said electric arc. To minimize said amplitude of high voltage necessary to establish the arc, one can in certain cases use a cathode or an anode with a pointed end and/or a small anode/cathode distance. This is for example the case when welding and plasma cutting in which the arc is struck in general between the nozzle and the electrode of the plasma welding torch used. In manual TIG welding, the operator is himself obliged to position correctly and precisely the electrode relative to the piece to be welded, which is not easily carried out in practice, particularly when a welding mask is used. Conversely, in the case of poor positioning of the electrode relative to the piece to be welded, the amplitude of the high voltage applied may not be sufficient to strike effectively an electric arc and/or an excessively long striking time may be needed. It follows that it is accordingly necessary to increase the amplitude of the high voltage pulses, which permits increasing the tolerance as to the workpiece/electrode distance and/or the sharpening of the electrode, and can lead on the contrary to an unacceptable level of electromagnetic noise.
US Orbital Segment The US Orbital Segment (USOS) is the name given to the components of the International Space Station (ISS) constructed and operated by the United States National Aeronautics and Space Administration (NASA), European Space Agency (ESA), Canadian Space Agency (CSA) and Japan Aerospace Exploration Agency (JAXA). The segment currently consists of eleven pressurized components and various external elements, all of which were delivered by the Space Shuttle. The segment is monitored and controlled from various mission control centers around the world including Lyndon B. Johnson Space Center in Houston, Texas, Columbus Control Center in Oberpfaffenhofen, Germany, Tsukuba Space Center in Tsukuba, Japan, and Marshall Space Flight Center in Huntsville, Alabama. Modules The US Orbital Segment consists of 10 pressurized modules. Of these, seven are habitable, and three are connecting nodes with large ports. The ports are used to connect the modules together or provide berths and docks for spacecraft. Nodes Each of the nodes has ports called Common Berthing Mechanisms (CBM). All three nodes have 4 ports around their exterior, and 1 port on each end, 6 ports in total. In addition to the 18 ports on the nodes there are additional ports on the modules, most of these are used for mating modules together, while unused CBM ports can berth one of the re-supply spacecraft MPLM, HTV, Dragon Cargo or Cygnus. There are two PMA adapters that change CBM ports to docking ports, the type used by Soyuz, Progress, Automated Transfer Vehicle, and the former Space Shuttle. Unity The first component of the USOS pressurized segment is the Unity. On the aft end of Unity is the Pressurized Mating Adapter (PMA) 1. The PMA-1 connects Unity with the Russian segment. Unity is also connected to the Quest airlock on the starboard side, Tranquility on the port side, and the Z1 truss on the zenith. The Destiny lab connects to the forward end, leading to the rest of the USOS. Unity is also used by the crews on board the ISS to eat meals and share some downtime together. The Unity node was delivered to the station by STS-88 on December 6, 1998. Harmony The Harmony is the central connecting node of the USOS. Harmony connects to the Destiny lab aft end, Kibo lab to the port side, and Columbus lab to the starboard side. The Harmony node's nadir and zenith ports also serves as the berthing port for H-II Transfer Vehicle (HTV), Dragon and Cygnus resupply vehicles. On the forward end of Harmony is PMA-2, which was used by visiting Space Shuttles as a mating adapter and by future manned missions to the ISS. On 18 July 2016, aboard SpaceX CRS-9, NASA launched the International Docking Adapter-2, to convert the Shuttle Apas-95 docking adapter to the NASA docking system, to be used with Crew Dragon and Boeing Starliner. Harmony was delivered by the STS-120 mission on October 23, 2007. Tranquility The Tranquility node houses the USOS life support systems. Tranquility also hosts the seven windowed Cupola module and the Leonardo module on its forward port. The forward facing port of Tranquility is blocked by the station's truss structure, while the aft facing port is free for use. While the nadir port is used by the Cupola, the zenith port is used by some exercise equipment inside the node. The starboard port is connected to node 1, and the port side is occupied by the PMA 3, previously a backup for the Shuttle docking, which will receive International Docking Adapter-3 during CRS-18, to allow connection with the Crew Dragon and Boeing Starliner. The Tranquility module was delivered by STS-130 in February 2010, together with the Cupola. Destiny The Destiny laboratory is the American-built laboratory module. It is used for medical, engineering, biotechnological, physics, materials science and Earth science research. Destiny also houses a back-up robotic work station, and was the first of the USOS laboratories to be delivered. It was delivered by STS-98 on February 7, 2001. The Destiny lab is managed by mission control centers in Houston, Texas and Huntsville, Alabama. Columbus Columbus is a laboratory module built by the European Space Agency. It is host to scientific research in fluids, biology, medicine, materials and Earth sciences. Columbus also has four external payload locations, used to expose experiments to the vacuum of space. The Columbus module was delivered to the ISS by STS-122 on February 7, 2008. The Columbus Control Center, located in Germany, is responsible for the Columbus module. Kibo The Kibo laboratory is the Japanese component of the USOS. Kibo has four main parts: the Kibo lab itself, a pressurized cargo container, an exposed science platform and two robotic arms. The module is unique in that it has a small airlock, which can be used to pass payloads to the robotic arms or astronauts outside the station. The robotic arms are controlled from a work station inside the lab. The lab is used for research in medicine, engineering, biotechnology, physics, materials science and Earth science. The logistics container was the first part of Kibo to arrive. It was delivered by STS-123 in March 2008. The Kibo lab itself was delivered to the ISS by the STS-124 mission in May 2008. The exposed facility was brought to the ISS by the STS-127 mission in July 2009. The JEM Control center in Tsukuba, Japan is responsible for all elements of the Kibo laboratory. Quest The Quest Joint Airlock is used to host spacewalks from the USOS segment of the ISS. It consists of two main parts: the equipment lock and the crew lock. The equipment lock is where the Extravehicular Mobility Units are stored and preparations for spacewalks are carried out. The crew lock is depressurized during spacewalks. The Quest airlock was delivered and installed by the STS-104 crew in July 2001. Leonardo The Leonardo module, also known as the Permanent Multipurpose Module (PMM), is a module used for stowage space on the ISS. Leonardo is attached to the forward-facing side of the Tranquility node. The PMM was delivered to the ISS by the STS-133 mission in early 2011. Originally the Multi-Purpose Logistics Module (MPLM) Leonardo, it was converted to stay on orbit for an extended period of time prior to being installed on the ISS. Cupola The Cupola is a seven-windowed module attached to the Tranquillity module. It is used for Earth observation and houses some gym equipment. All of the seven windows have covers that are closed when the windows aren't used, to protect the station from space debris impact. The Cupola was delivered together with the Tranquility node by STS-130 in February 2010. Pressurized Mating Adapter The Pressurized Mating Adapters (PMA) serve as docking ports on the USOS portion of the ISS. It converts the standard Common Berthing Mechanism to APAS-95, the docking system that was used by the Space Shuttle and the Russian Orbital Segment. Currently PMA-1 is used to connect the Unity node with the Zarya module on the ISS. Pressurized Mating Adapter-2 is located on the forward end of Harmony, while PMA-3 is located in the zenith port of the same node. PMA-2 was the main Shuttle docking port, with PMA-3 being its backup, used only a few times. With the new Crew Commercial Program and the retirement of the Shuttle fleet, NASA built the International Docking Adapter, to convert PMA-2 and PMA-3 to the NASA Docking System. IDA-1 was supposed to dock with PMA-2, but was lost in the SpaceX CRS-7 launch failure. Thus IDA-2, which was brought by SpaceX CRS-9 and was supposed to dock to PMA-3, was shifted to PMA-2. IDA-3, the replacement for the lost IDA-1, that will be berthed to PMA-3, will launch in July 2019 on SpaceX CRS-18. PMA-1 and PMA-2 were delivered with the Unity node on STS-88 in December 1998. The third PMA was delivered by STS-92 on October 11, 2000. Integrated Truss Structure The Integrated Truss Structure (ITS) houses vital equipment on the exterior of the ISS. Each segment of truss is given a designation of P or S, indicating whether the segment is on the port or starboard side, and a number which indicates its position on its respective side. The truss system itself consists of 12 total segments—four on each side, and one central segment—which are connected to the ISS by attachment points on the Destiny module. The thirteenth piece, known as the Zenith-1 (Z1) truss segment, is attached to the Unity module, and was originally used to hold the P6 solar arrays to provide power to the USOS. The Z1 segment now houses the Kᵤ-band antennas and serves as a routing point for power and data cables on the exterior of the ISS. The Integrated Truss Structure is made from stainless steel, titanium and aluminum. It spans approximately 110 meters long and houses four sets of solar arrays. Each set of solar arrays contains four arrays for a total of 16 solar arrays. Each of the four sets of arrays also has an associated cooling system and radiator for cooling the power supply equipment. The Integrated Truss Structure also houses the main cooling system for the ISS, which consists of two pumps, two radiator arrays, and two ammonia and two nitrogen tank assemblies. There are also several payload attachment points located on the Integrated Truss Structure. These points host the External Stowage Platforms, External Logistics Carriers, Alpha Magnetic Spectrometer and the Mobile Base System for the Canadarm2. The Z1 truss was delivered by the STS-92 mission in October 2000. The P6 segment was installed on STS-97 in December 2000. The S0 truss was delivered to the ISS on STS-110, with the S1 segment following on STS-112. The P1 segment of the truss was brought to the ISS by STS-113, followed by the P3/P4 segment on STS-115, and the P5 segment on STS-116. The S3/S4 truss segment was delivered by STS-117, followed by the S5 segment STS-118. The last component of the truss segment, the S6 segment, was delivered by STS-119. External Stowage Platform The External Stowage Platforms (ESP), are a series of platforms that are used to store Orbital Replacement Units (ORU) on the ISS. The ESP's provide power to the ORU's but do not allow command and data handling. External Stowage Platform 1 is located on the port side of the Destiny lab and was delivered on the STS-102 mission in March 2001. ESP-2 is located on the port side of the Quest airlock, and was brought to the ISS by the STS-114 crew in 2005. ESP-3 is located on the Starboard 3 (S3) truss segment and was delivered to the ISS on the STS-118 mission in August 2007. ExPRESS logistics carrier The ExPRESS logistics carriers (ELCs) are similar to the External Stowage Platform, but designed to carry more cargo. Unlike the ESPs, the ELCs allow for command and data handling. They utilize a steel grid structure where external mounted containers, payloads and gyroscopes are mounted; and science experiments can be fitted. Some ELC components have been built by the Brazilian Space Agency. ExPRESS Logistics Carriers 1, located on the lower P3 truss, and ELC 2, located on the upper S3 truss, were delivered by the STS-129 mission in November 2009. ELC-3 was brought to the ISS by the STS-134 crew, is located on the upper P3 truss. ELC-4 was delivered and installed on the lower S3 truss segment, during the STS-133 mission. Alpha Magnetic Spectrometer 2 The Alpha Magnetic Spectrometer (AMS) is a particle physics experiment that is mounted on the S3 truss segment. The AMS is designed to search for dark matter and anti-matter. Five hundred scientists from 56 different institutions and 16 countries participated in the development and construction of the AMS. The Alpha Magnetic Spectrometer was delivered by the STS-134 crew. Mobile Servicing System The components of the MSS were supplied by the Canadian Space Agency in conjunction with MDA Space Missions. The Mobile Transporter that carries the Mobile Base System was designed and built by Northrop Grumman under contract with NASA. Canadarm2 The main component of the mobile servicing system is the Canadarm2, also known as the Space Station Remote Manipulator System (SSRMS). The arm is capable of moving large, heavy payloads that cannot be handled by astronauts during a spacewalk. The arm has a payload capacity of 116,000 kg (256,000 lb), and 7 degrees of freedom. Canadarm2 is also capable of changing where it is stationed and what end is used. There are grapple fixtures for the Candarm2 on the Destiny lab, Harmony node, Unity node and the Mobile Base System. A grapple fixture is installed on the Zarya module, but does not have data cables connected. Once these cables are connected, the Canadarm2 will be able to position itself on the exterior of Zarya and will be able to support Extra-vehicular Activity (EVA) in the vicinity the Russian Orbital Segment (ROS). The Canadarm2 was assembled and installed by the STS-100 crew in early 2001. Special Purpose Dextrous Manipulator The Special Purpose Dexterous Manipulator (SPDM), also known as Dextre, is a two armed robot that can be attached to the ISS, the Mobile Base System or Canadarm2. Dextre is capable of performing tasks that would otherwise require an astronaut to perform. These tasks include switching orbital replacement units or moving ORUs from their stowage locations to where they are to be installed. Using Dextre can reduce preparatory time needed to perform certain tasks and afford astronauts the ability to invest more time in the completion of other tasks. Dextre's primary grapple fixture is located on the Destiny lab, but can also be mounted on any powered grapple fixture on the ISS. It has a payload capacity of 600 kg (1,300 lb), and 15 degrees of freedom. Dextre was delivered to the ISS by STS-123. Mobile Base System The Mobile Base System (MBS) is a rail car-like device installed on the Integrated Truss Structure of the ISS. It weighs 886 kg (1,953 lb), and has a payload capacity of 20,954 kg (46,196 lb). The MBS can move from the Starboard 3 (S3) to the Port 3 (P3) truss segments and has a top speed of 2.5 cm/s (0.082 ft/s). The MBS has four PDGFs which can be used as mounts for the Canadarm2 and Dextre, as well as a Payload/Orbital Replacement Unit Accommodations (POA), to hold payloads and Orbital Replacement Units (ORUs). The MBS also has a common attach system, to grapple a special capture bar on payloads. It also has its own main computer and video distribution units, and remote power control modules. The MBS was delivered on STS-111 in June 2002. Enhanced ISS Boom Assembly The Enhanced ISS Boom Assembly is used to extend the reach of Canadarm2 and provides detailed inspection capability. There are lasers and cameras at the end of the boom able to record at a resolution of a few millimeters. The boom is also fitted with handrails, so that it can assist spacewalkers during EVAs as was done on STS-120 to repair the solar arrays.
<filename>src/prepared_source_classes.py from mapping_classes import InputClass class PreparedSourceObject(InputClass): """Parent class""" def _parent_class_fields(self): return ["i_exclude"] def _post_process_fields(self, field_list): if len(field_list): for additional_field in self._parent_class_fields(): if additional_field not in field_list: field_list += [additional_field] return field_list def fields(self): return self._post_process_fields(self._fields()) def _fields(self): return [] class SourceLocationObject(PreparedSourceObject): """A location""" def _fields(self): return ["k_location", "s_address_1", "s_address_2", "s_city", "s_state", "s_zip", "s_county", "s_location_name"] class SourcePersonObject(PreparedSourceObject): """A person""" def _fields(self): return ["s_person_id", "s_gender", "m_gender", "s_birth_datetime", "s_death_datetime", "s_race", "m_race", "s_ethnicity", "m_ethnicity", "k_location"] class SourceObservationPeriodObject(PreparedSourceObject): """An observation period for the person""" def _fields(self): return ["s_person_id", "s_start_observation_datetime", "s_end_observation_datetime"] class SourceEncounterObject(PreparedSourceObject): """An encounter or visit""" def _fields(self): return ["s_encounter_id", "s_person_id", "s_visit_start_datetime", "s_visit_end_datetime", "s_visit_type", "m_visit_type", "k_care_site", "s_discharge_to", "m_discharge_to", "s_admitting_source", "m_admitting_source", "i_exclude"] class SourceEncounterDetailObject(PreparedSourceObject): """An encounter or visit""" def _fields(self): return ["s_encounter_detail_id", "s_person_id", "s_encounter_id", "s_start_datetime","s_end_datetime", "k_care_site", "s_visit_detail_type", "m_visit_detail_type", "i_exclude"] class SourceResultObject(PreparedSourceObject): """Result: labs and procedures""" def _fields(self): return ["s_person_id", "s_encounter_id", "s_obtained_datetime", "s_name", "s_code", "s_type_code", "m_type_code_oid", "s_result_text", "m_result_text", "s_result_numeric", "s_result_datetime", "s_result_code", "m_result_code_oid", "s_result_unit", "s_result_unit_code", "m_result_unit_code_oid", "s_result_numeric_lower", "s_result_numeric_upper", "i_exclude"] class SourceConditionObject(PreparedSourceObject): """Conditions: Diagnosis codes""" def _fields(self): return ["s_person_id", "s_encounter_id", "s_start_condition_datetime", "s_end_condition_datetime", "s_condition_code", "s_condition_code_type", "m_condition_code_oid", "s_sequence_id", "s_rank", "m_rank", "s_condition_type", "s_present_on_admission_indicator", "i_exclude"] class SourceProcedureObject(PreparedSourceObject): """Procedures""" def _fields(self): return ["s_person_id", "s_encounter_id", "s_start_procedure_datetime", "s_end_procedure_datetime", "s_procedure_code", "s_procedure_code_type", "m_procedure_code_oid", "s_sequence_id", "s_rank", "m_rank", "i_exclude"] class SourceMedicationObject(PreparedSourceObject): """Ordered, administered medications and drugs""" def _fields(self): return ["s_person_id", "s_encounter_id", "s_drug_code", "s_drug_code_type", "m_drug_code_oid", "s_drug_text", "s_drug_alternative_text", "s_start_medication_datetime", "s_end_medication_datetime", "s_route", "m_route", "s_quantity", "s_dose", "m_dose", "s_dose_unit", "m_dose_unit", "s_status", "s_drug_type", "m_drug_type", "i_exclude"] class SourceEncounterCoverageObject(PreparedSourceObject): """Even though encounter is not included in CDM we include it as this is how the hosptial sees it""" def _fields(self): return ["s_person_id", "s_encounter_id", "s_start_payer_date", "s_end_payer_date", "s_payer_name", "m_payer_name", "s_plan_name", "m_plan_name"] class SourceCareSiteObject(PreparedSourceObject): def _fields(self): return ["k_care_site", "s_care_site_name"] class SourceProviderObject(PreparedSourceObject): def _fields(self): return ["k_provider", "s_provider_name", "s_npi"]
// RUN: %clang_cc1 -no-opaque-pointers -triple armv7-eabi -emit-llvm %s -o - | \ // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-SOFT // RUN: %clang_cc1 -no-opaque-pointers -triple armv7-eabi -target-abi aapcs -mfloat-abi hard -emit-llvm %s -o - | \ // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-HARD // REQUIRES: arm-registered-target // CHECK: %struct.S0 = type { [4 x float] } // CHECK: %struct.S1 = type { [2 x float] } // CHECK: %struct.S2 = type { [4 x float] } // CHECK: %struct.D0 = type { [2 x double] } // CHECK: %struct.D1 = type { [2 x double] } // CHECK: %struct.D2 = type { [4 x double] } typedef struct { float v[4]; } S0; float f0(S0 s) { // CHECK-SOFT: define{{.*}} float @f0([4 x i32] %s.coerce) // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc float @f0(%struct.S0 %s.coerce) return s.v[0]; } float f0call() { S0 s = {0.0f, }; return f0(s); // CHECK-SOFT: call float @f0([4 x i32] // CHECK-HARD: call arm_aapcs_vfpcc float @f0(%struct.S0 } typedef struct { __attribute__((aligned(8))) float v[2]; } S1; float f1(S1 s) { // CHECK-SOFT: define{{.*}} float @f1([1 x i64] // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc float @f1(%struct.S1 alignstack(8) return s.v[0]; } float f1call() { S1 s = {0.0f, }; return f1(s); // CHECK-SOFT: call float @f1([1 x i64 // CHECK-HARD: call arm_aapcs_vfpcc float @f1(%struct.S1 alignstack(8) } typedef struct { __attribute__((aligned(16))) float v[4]; } S2; float f2(S2 s) { // CHECK-SOFT: define{{.*}} float @f2([2 x i64] // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc float @f2(%struct.S2 alignstack(8) return s.v[0]; } float f2call() { S2 s = {0.0f, }; return f2(s); // CHECK-SOFT: call float @f2([2 x i64] // CHECK-HARD: call arm_aapcs_vfpcc float @f2(%struct.S2 alignstack(8) } typedef struct { double v[2]; } D0; double g0(D0 d) { // CHECK-SOFT: define{{.*}} double @g0([2 x i64] // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc double @g0(%struct.D0 %d.coerce return d.v[0]; } double g0call() { D0 d = {0.0, }; return g0(d); // CHECK-SOFT: call double @g0([2 x i64] // CHECK-HARD: call arm_aapcs_vfpcc double @g0(%struct.D0 %1 } typedef struct { __attribute__((aligned(16))) double v[2]; } D1; double g1(D1 d) { // CHECK-SOFT: define{{.*}} double @g1([2 x i64] // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc double @g1(%struct.D1 alignstack(8) return d.v[0]; } double g1call() { D1 d = {0.0, }; return g1(d); // CHECK-SOFT: call double @g1([2 x i64] // CHECK-HARD: call arm_aapcs_vfpcc double @g1(%struct.D1 alignstack(8) } typedef struct { __attribute__((aligned(32))) double v[4]; } D2; double g2(D2 d) { // CHECK-SOFT: define{{.*}} double @g2([4 x i64] // CHECK-HARD: define{{.*}} arm_aapcs_vfpcc double @g2(%struct.D2 alignstack(8) return d.v[0]; } double g2call() { D2 d = {0.0, }; return g2(d); // CHECK-SOFT: call double @g2([4 x i64] // CHECK-HARD: call arm_aapcs_vfpcc double @g2(%struct.D2 alignstack(8) }
package com.github.dritter.hd.dlog.internal; import java.util.Collection; import java.util.Iterator; import com.github.dritter.hd.dlog.evaluator.DlogEvaluator; import com.github.dritter.hd.dlog.evaluator.IFacts; import com.github.dritter.hd.dlog.parser.DlogEvaluatorParser; import com.github.dritter.hd.dlog.parser.DlogParser; import com.github.dritter.hd.dlog.evaluator.DlogEvaluator; import com.github.dritter.hd.dlog.parser.DlogParser; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import com.github.dritter.hd.dlog.evaluator.IFacts; import com.github.dritter.hd.dlog.parser.DlogEvaluatorParser; public class DlogEvaluatorParserTest { private DlogEvaluatorParser evalParser; private DlogParser parser; @Before public void setup() throws Exception { this.evalParser = DlogEvaluatorParser.create(); this.parser = new DlogParser(); } @Test(expected = IllegalArgumentException.class) public void testParse_null() throws Exception { this.evalParser.parse(null); } @Test public void testParse_empty() throws Exception { this.evalParser.parse(""); } @Test(expected = UnsupportedOperationException.class) public void testParse_rule() throws Exception { this.evalParser.parse("q(A, B) :- q(B, A), r(B, A)."); } @Test public void testParse_facts() throws Exception { this.evalParser.parse("q(\"hasi\", 17).r(23, \"dritter\")."); final Collection<IFacts> facts = this.evalParser.getFacts(); Assert.assertNotNull(facts); Assert.assertEquals(2, facts.size()); final Iterator<IFacts> iterator = facts.iterator(); Assert.assertEquals(1, iterator.next().getValues().size()); Assert.assertEquals(1, iterator.next().getValues().size()); } @Test public void testParse_factsMulti() throws Exception { this.evalParser.parse("q(\"hasi\", 17).q(\"dritter\", 23).r(23, \"dritter\").r(17, \"hasi\")."); final Collection<IFacts> facts = this.evalParser.getFacts(); Assert.assertNotNull(facts); Assert.assertEquals(2, facts.size()); final Iterator<IFacts> iterator = facts.iterator(); Assert.assertEquals(2, iterator.next().getValues().size()); Assert.assertEquals(2, iterator.next().getValues().size()); } @Test public void testParse_factsEval() throws Exception { this.evalParser.parse("q(\"hasi\", 23).r(23, \"dritter\")."); final Collection<IFacts> facts = this.evalParser.getFacts(); Assert.assertNotNull(facts); Assert.assertEquals(2, facts.size()); final DlogEvaluator eval = DlogEvaluator.create(); eval.initalize(facts, "qr(A,Z) :- q(A,N), r(N, Z)."); final IFacts query = eval.query("qr", 2); Assert.assertEquals(1, query.getValues().size()); } @Test public void testParseResult_equals() throws Exception { this.evalParser.parse("q(\"dritter\", 17).r(23, \"dritter\")."); this.parser.parse("q(\"dritter\", 17).r(23, \"dritter\")."); final Collection<IFacts> evalFacts = this.evalParser.getFacts(); final Collection<com.github.dritter.hd.dlog.IFacts> internalFacts = this.parser.getFacts(); // Assert.assertEquals(internalFacts.toString(), evalFacts.toString()); final DlogEvaluator eval = DlogEvaluator.create(); eval.initalize(evalFacts, "qr(A,Z) :- q(A,N), r(Z, A)."); final IFacts query = eval.query("qr", 2); Assert.assertEquals(1, query.getValues().size()); final DlogEvaluator eval2 = DlogEvaluator.create(); eval2._initalize(internalFacts, "qr(A,Z) :- q(A,N), r(Z, A)."); final IFacts query2 = eval2.query("qr", 2); Assert.assertEquals(1, query2.getValues().size()); } @Test public void testParseResult_selection() throws Exception { this.evalParser.parse("q(\"hasi\", 17).q(\"dritter\", 23)."); this.parser.parse("q(\"hasi\", 17).q(\"dritter\", 23)."); final Collection<IFacts> evalFacts = this.evalParser.getFacts(); final Collection<com.github.dritter.hd.dlog.IFacts> internalFacts = this.parser.getFacts(); // Assert.assertEquals(internalFacts.toString(), evalFacts.toString()); final DlogEvaluator eval = DlogEvaluator.create(); eval.initalize(evalFacts, "qr(A,N) :- q(A,N), =c(A, \"has\")."); final IFacts query = eval.query("qr", 2); Assert.assertEquals(1, query.getValues().size()); final DlogEvaluator eval2 = DlogEvaluator.create(); eval2._initalize(internalFacts, "qr(A,N) :- q(A,N), =c(A, \"has\")."); final IFacts query2 = eval2.query("qr", 2); Assert.assertEquals(1, query2.getValues().size()); } @Test public void testParseResult_numericalExpression() throws Exception { this.evalParser.parse("q(\"hasi\", 17).q(\"dritter\", 23)."); this.parser.parse("q(\"hasi\", 17).q(\"dritter\", 23)."); final Collection<IFacts> evalFacts = this.evalParser.getFacts(); final Collection<com.github.dritter.hd.dlog.IFacts> internalFacts = this.parser.getFacts(); // Assert.assertEquals(internalFacts.toString(), evalFacts.toString()); final DlogEvaluator eval = DlogEvaluator.create(); eval.initalize(evalFacts, "qr(A,N) :- q(A,N), >(N, 17)."); final IFacts query = eval.query("qr", 2); Assert.assertEquals(1, query.getValues().size()); final DlogEvaluator eval2 = DlogEvaluator.create(); eval2._initalize(internalFacts, "qr(A,N) :- q(A,N), >(N, 17)."); final IFacts query2 = eval2.query("qr", 2); Assert.assertEquals(1, query2.getValues().size()); } @Test public void testParseResult_noDuplicateRuleResults() throws Exception { this.evalParser.parse("q(\"hasi\", 17).q(\"hasi\", 27).q(\"dritter\", 23)."); this.parser.parse("q(\"hasi\", 17).q(\"hasi\", 27).q(\"dritter\", 23)."); final Collection<IFacts> evalFacts = this.evalParser.getFacts(); final Collection<com.github.dritter.hd.dlog.IFacts> internalFacts = this.parser.getFacts(); // Assert.assertEquals(internalFacts.toString(), evalFacts.toString()); final DlogEvaluator eval = DlogEvaluator.create(); eval.initalize(evalFacts, "qr(A) :- q(A,N)."); final Collection<com.github.dritter.hd.dlog.IFacts> query = eval.evaluateRules(); Assert.assertEquals("('hasi')\n('hasi')\n('dritter')\n", query.iterator().next().getValues().toString()); final DlogEvaluator eval2 = DlogEvaluator.create(); eval2._initalize(internalFacts, "qr(A) :- q(A,N)."); final Collection<com.github.dritter.hd.dlog.IFacts> query2 = eval.evaluateRules(); // FIXME: Assert.assertEquals("('hasi')\n('hasi')\n('dritter')\n", // query2.iterator().next().getValues().toString()); } @Test public void testParseResult_queryNoRules() throws Exception { this.evalParser.parse("q(\"hasi\", 17).q(\"dritter\", 23)."); this.parser.parse("q(\"hasi\", 17).q(\"dritter\", 23)."); final Collection<IFacts> evalFacts = this.evalParser.getFacts(); final Collection<com.github.dritter.hd.dlog.IFacts> internalFacts = this.parser.getFacts(); // Assert.assertEquals(internalFacts.toString(), evalFacts.toString()); final DlogEvaluator eval = DlogEvaluator.create(); eval.initalize(evalFacts, ""); final IFacts query = eval.query("q", 2); Assert.assertEquals(2, query.getValues().size()); final DlogEvaluator eval2 = DlogEvaluator.create(); eval2._initalize(internalFacts, ""); final IFacts query2 = eval2.query("q", 2); Assert.assertEquals(2, query2.getValues().size()); } @Test public void testTypeSerialization() throws Exception { this.evalParser.parse("q(17,\"hasi\").q(23,\"hasi\")."); final IFacts original = this.evalParser.getFacts().iterator().next(); final DlogEvaluatorParser localParser = DlogEvaluatorParser.create(); localParser.parse(original.toString()); localParser.getFacts().iterator().next(); Assert.assertEquals(original.toString(), localParser.getFacts().iterator().next().toString()); } @Ignore @Test public void testEval() throws Exception { String facts = "position(0, 0, 0)." + "position(0, 0, 1)." + "position(0, -1, 2)." + "position(0, -1, 3)." + "position(0, -2, 4)." + "position(0, -2, 5)." + "position(0, -3, 6)." + "position(0, -3, 7)." + "position(0, -4, 8)." + "position(-1, -5, 9)." + "position(0, -1, 10)." + "position(0, 3, 11)." + "position(0, 7, 12)." + "position(0, 11, 13)." + "position(0, 15, 14)." + "position(0, 14, 15)." + "position(0, 14, 16)." + "position(0, 14, 17)." + "position(0, 14, 18)." + "position(7, 13, 19)." + "position(15, 13, 20)." + "position(23, 13, 21)." + "position(30, 13, 22)." + "position(38, 13, 23)." + "position(46, 13, 24)." + "position(54, 13, 25)." + "position(61, 12, 26)." + "position(69, 12, 27)." + "position(77, 12, 28)." + "position(84, 12, 29)." + "position(92, 12, 30)."; this.evalParser.parse(facts); String ruleString = "position-qad-0-0(Player,X,Y):-position(Player,X,Y), >(X,-525), <(X,515), >(Y,-340), <(Y,330)."; DlogEvaluator evaluator = DlogEvaluator.create(); Collection<IFacts> facts2 = this.evalParser.getFacts(); evaluator.initalize(facts2, ruleString); Collection<com.github.dritter.hd.dlog.IFacts> correspondingFacts = evaluator.evaluateRules(); Assert.assertTrue(correspondingFacts.size() > 1); } @Test public void testName() throws Exception { final String facts = "TRAJECTORIES(-3.0286579501667053E17, 3.4169866605512161E18). Pos-subObj(1.26606916742304845E18, -2.468041330049512E17, 0, 0, 0). Pos-subObj(3.7110172570606812E18, -2.468041330049512E17, 0, 0, 1). Pos-subObj(6.5300030972400282E18, -2.468041330049512E17, -1, 0, 2). Pos-subObj(-2.0373265970706967E18, -2.468041330049512E17, -1, 0, 3). Pos-subObj(-7.4769713543983729E18, -2.468041330049512E17, -2, 0, 4). Pos(-2.468041330049512E17, 5.4261754488193198E18). root(3.4169866605512161E18). PLAYER(5.4261754488193198E18, 1, -3.0286579501667053E17, 0, 23208)."; this.evalParser.getFacts(); final String ruleString = "position(Player,X,Y,Time):-Pos-subObj(Uid,Pos2Id,Y,X,Time), Pos(Pos2Id,PlayerId), PLAYER(PlayerId,Player,B,C,D).position(Player,X,Y,Time):-Pos-subObj(Uid,Pos2Id,Y,X,Time), Pos2(Pos2Id,PlayerId), PLAYER(PlayerId,Player,A,B,C,D)."; } }
import bisect s = input() t = input() lis = [[]for _ in range(26)] for i,j in enumerate(s): j = ord(j) -ord("a") lis[j].append(i) lenlis = [len(lis[i]) for i in range(26)] now = 0 ans = 0 for i in t: i = ord(i) -ord("a") if lenlis[i] == 0: ans = -1 break insert_index = bisect.bisect_left(lis[i],now) if insert_index == lenlis[i]: ans += 1 now = lis[i][0] +1 else: now = lis[i][insert_index] + 1 if ans == -1: print(-1) else: ans = ans*len(s) + now print(ans)
<reponame>MultiW/nimble-xc import pathlib import numpy as np import matplotlib.pyplot as pyplot import pandas as pd # import types from pandas import DataFrame from numpy import ndarray # Raw IMU data column names ELAPSED = 'elapsed (s)' XACCEL = 'x-axis (g)' YACCEL = 'y-axis (g)' ZACCEL = 'z-axis (g)' # NumPy column indices TIME_COL = 0 XACCEL_COL = 1 YACCEL_COL = 2 ZACCEL_COL = 3 SIDE = 'side' TEST = 'test' def preprocess_raw_imu(raw_data: DataFrame) -> ndarray: # Replace negative "time" values. Replace with interpolated values from their neighbors raw_data.loc[raw_data[ELAPSED] < 0, ELAPSED] = None raw_data[ELAPSED] = raw_data[ELAPSED].interpolate(method ='linear', limit_direction ='forward', axis=0) # TODO Check "time" values that aren't in order? # - Think this was a possibility. Plot the entire raw IMU data to check again. # Note: make sure order matches global constants return raw_data[[ELAPSED, XACCEL, YACCEL, ZACCEL]].to_numpy() if __name__ == "__main__": curr_dir:str = pathlib.Path(__file__).parents[0].absolute() # Import data # input (raw IMU data) raw_data: DataFrame = pd.read_csv(curr_dir / "11L_2020-08-13T09.48.23.554_E8E376103A59_Accelerometer.csv") # labels (of ski steps) boot_labels: DataFrame = pd.read_csv(curr_dir / "boot3MT_20210201.csv") pole_labels: DataFrame = pd.read_csv(curr_dir / "pole3MT_20210201.csv") # Pre-process raw data raw_data: ndarray = preprocess_raw_imu(raw_data) # == Boot Ski Test == boot_raw = raw_data[11849:21339,:] boot_labels = boot_labels[(boot_labels[SIDE] == 'L') & (boot_labels[TEST] == 'skate')]
New-onset type II diabetes mellitus, hyperosmolar non-ketotic coma, rhabdomyolysis and acute renal failure in a patient treated with sulpiride. Sir, Various drugs have been reported to cause myoglobinuric acute renal failure . In this report, we present a case of oral sulpiride administration, complicated with new-onset type II diabetes mellitus, hyperosmolar non-ketotic coma, rhabdomyolysis and acute renal failure. Case. A 44-year-old female patient consulted a psychiatrist for her complaints of anxiety and hallucination. At the time, her laboratory results were normal. Oral sulpiride had been administered at a dose of 200mg per day and increased to 600mg/day gradually. At admission to our hospital 3 days later, she was unconscious. On physical examination, her blood pressure was 90/60mmHg and her temperature was 38.5 C; turgor-tonus was diminished and muscle rigidity was present. Abnormal laboratory analyses were as follows: white blood cell count 17 10/ml, serum glucose 389mg/dl, blood urea nitrogen 76mg/dl, serum creatinine 5.0mg/dl, sodium 168mmol/l, calcium 7.8mg/dl, creatine phosphokinase 7070U/l, aspartate transaminase 151U/l, alanine transaminase 52U/l, lactate dehydrogenase 654U/l and blood osmolality 360mosm/kg H2O. Her serum myoglobin level was 4360 ng/ml (normal range: 764) and her urinary myoglobin level was 7620 ng/ml (normal range: 0200). Serum islet cell antibody and glutamic acid decarboxylase antibodies were negative. Insulin and C-peptide were increased after the intravenous administration of 1mg of glucagon. HbA1c was normal (5.0%). Urinary dipstick analysis was 2 positive for glucose, 1 positive for protein, negative for ketone and 3 positive in the haem test. Urinary sediment showed a few red blood cells and 23 leukocytes per high-power field. No microbial agent was grown in cultures. Renal ultrasonography and electromyography (EMG) examination were normal. Sulpiride was withdrawn. She was treated with bicarbonate and intensive insulin. On the 12th day, her mental status, fever and laboratory analysis returned to normal (figure 1). On psychiatric evaluation, a brief psychotic disorder was diagnosed. One month after discharge, all laboratory analyses remained normal and the patient had no complaints. Discussion. Sulpiride is a selective dopamine D2 antagonist with antipsychotic and antidepressant activity. Sulpiride has been associated with many side effects . Only one case of neuroleptic malignant syndrome with myoglobinuric acute renal failure after withdrawal of sulpiride and maprotiline therapy was described in the literature. However, in this case, new-onset diabetes mellitus and hyperosmolar non-ketotic coma had not been reported. Our patient had no prior diagnosis of diabetes. New-onset diabetes mellitus due to administration of clozapine, olanzapine, risperidone and quetiapine has been reported previously. However, there was no case of new-onset diabetes mellitus being caused by sulpiride intake. The precise mechanism of antipsychoticassociated diabetes is unclear. Rhabdomyolysis is frequently observed in diabetics. We considered that dehydration, non-ketotic coma, hyperthermia, hyperosmolality due to severe hypernatraemia and neuroleptic malignant syndrome were the main causes of rhabdomyolysis in our case. We thought that the trigger was sulpiride administration. We excluded the main causes of rhabdomyolysis according to history and laboratory tests. The kidney is the most common site of complication in rhabdomyolysis, and acute renal failure may occur. In our case, acute renal failure also occurred and was improved with adequate therapy. On the 12th day of hospitalization, the insulin therapy was withdrawn and the serum glucose levels persisted in the normal range with diet regulation. The psychiatric symptoms disappeared, so antipsychotic therapy was no longer required. The complications of sulpiride therapy were observed to be temporary in our case. In conclusion, physicians should be aware of the potential risks of new-onset diabetes mellitus, hyperosmolar nonketotic coma, rhabdomyolysis and acute renal failure in patients receiving sulpiride treatment.
The potential of microwave links for providing information concerning the amount and type of precipitation In this paper we summarize the findings of three research contracts undertaken in the period 1999-2008. We show that microwave links can provide accurate estimates of path-averaged rainfall and that they can be used for the remote detection of snow and melting snow. They are also shown to be effective in online adjustment of weather radars.
Metabolomic-based biomarker discovery for non-invasive lung cancer screening: A case study Background Lung cancer (LC) is one of the leading lethal cancers worldwide, with an estimated 18.4% of all cancer deaths being attributed to the disease. Despite developments in cancer diagnosis and treatment over the previous thirty years, LC has seen little to no improvement in the overall five year survival rate after initial diagnosis. Methods In this paper, we extended a recent study which profiled the metabolites in sputum from patients with lung cancer and age-matched volunteers smoking controls using flow infusion electrospray ion mass spectrometry. We selected key metabolites for distinguishing between different classes of lung cancer, and employed artificial neural networks and leave-one-out cross-validation to evaluate the predictive power of the identified biomarkers. Results The neural network model showed excellent performance in clas sification between lung cancer and control groups with the area under the receiver operating characteristic curve of 0.99. The sensitivity and specificity of for detecting cancer from controls were 96% and 94% respectively. Furthermore, we have identified six putative metabolites that were able todiscriminate between sputum samples derived from patients suffering small cell lung cancer (SCLC) and non-small cell lung cancer. These metabolites achieved excellent cross validation performance with a sensitivity of 80% and specificity of 100% for predicting SCLC. Conclusions These results indicate that sputum metabolic profiling may have potential for screening of lung cancer and lung cancer recurrence, and may greatly improve effectiveness of clinical intervention.
16.1: Invited Paper: Measurement of Perceived Pixel Luminance of Large LED Displays Large screen LED displays are becoming increasingly popular. The human eye has a resolution of 1/60 degree, so at very close viewing the LED chips may be more easily seen because LED screens have a larger pixel pitch than traditional display technologies, unlike OLEDs and LCDs. In large LED displays, the perceived luminance of the pixels is highly dependent on the viewing distance and FOV. The paper examines the perceived pixel luminance of a large screen LED display at different viewing distances and field of views. Additionally, stray light was examined and discussed. The results indicated that the perceived pixel luminance can be significantly different under different viewing distances and FOVs. For future LED display performance evaluation, it would be advantageous to have a measuring device with high resolution that mimics the human eye's angular resolution in perceived pixel luminance.
Brexit: Britain to dismantle border controls 30/11/2017 Follow @eureferendum No such specific announcement has been made but that nevertheless is one conclusion that could be drawn from government evidence to the Northern Ireland Affairs Committee yesterday. In front of the committee, chaired by Conservative MP Dr Andrew Murrison, were Chloe Smith and Robin Walker, both Parliamentary Under Secretaries of State, respectively from the Northern Ireland Office and the Department for Exiting the European Union. Between them, under questioning from the chair, from Conservative MP (former Colonel) Bob Stewart and Lady Hermon (Independent), they affirmed that the UK would take no steps to harden the Northern Irish border after Brexit, even if we crash out without a deal. This is picked up by the "The UK would not under any circumstances want to be taking steps to harden that Border and interrupt people’s daily lives", the paper has him say. "So we will make sure that we will do everything in our power so people can go on with our daily lives and that our commitments under the Belfast Agreement are met. And whatever contingency planning the government undertakes will absolutely have those principles in mind". Colonel Bob Stewart was pretty emphatic in his line of questioning. As an officer of the 1st Cheshires, he'd done several tours in Northern Ireland at the height of the troubles, and had been hero of the Droppin Well bombing at Ballykelly in 1982. Since Colonel Bob knew that "hard borders" were indeed "hard", he didn't want to see border posts all over again. His experience of them being attacked had warned him off the idea. As far as Brexit was concerned, therefore, one way of doing it was to say that on the Northern Ireland side of the border, "there will be nothing on the border". We say to the EU, "you do what you want". We had to find a system, he said, where cars could move through the border without being stopped. Again, it was Robin Walker determined to share that vision. There would be no physical infrastructure on the border said the PUSS. "We don't believe there should be physical infrastructure on the border. We want to preserve the free movements that we have today". And that was enough for Colonel Bob. "If the European Union want to put up barricades, that's up to them", he declared. It was then the turn of the doughty Lady Hermon, she of the constituency of North Down. First elected for the Ulster Unionist Party, she had stood as an independent MP since 2010. And now she was asking the ministers how, in the event of a "no deal", you would avoid a hard border? "I need you to spell out what will happen in the event of a 'no deal'", she said. Yet again, it was for Robin Walker to do the business. "I reiterate", he said, "The UK would not under any circumstances want to take any steps to harden the border". And, to that effect, "we're not going to put up infrastructure, we're not going to do anything to harden the border". That was interesting phrasing: ""The UK would not … want to take any steps to harden the border", Walker had said. That's not exactly a ringing, absolute commitment – it's more of an aspiration. Nonetheless, we can see what the line is, the "take home" message is that the UK has no intention of putting up infrastructure at the border. And without that, any attempt to control traffic at the border would result in total chaos. Without the facilities, you simply cannot manage customs checks, much less the complex sanitary and phytosanitary checks. Therein lies the enigma. The UK imports goods from all over the world and, apart from EU goods, applies border controls of varying sophistication, as well as the "official controls" on animals and foods, and other products. But once we leave the EU, to us, EU countries have to be treated the same as all other countries with which we trade, under exactly the same terms. This is a matter of WTO rules – the one's that so many "ultras" are so keen to pursue. The WTO non-discrimination requirements mean that, if we apply no checks to EU goods at the Northern Irish border, then we cannot apply them anywhere else. It really is as simple as that. Yet, here we have two ministers of the crown, and a room full of MPs, and none of them thought to mention this simple fact. They were all prepared to blather about anything under the sun, but not one seemed to be aware that what was being proposed could not be validly implemented under international trade law without us first dismantling all our other customs and sanitary controls. Furthermore, the consequences of breaching WTO rules are not to be sneezed at. Any country adversely affected can complain to the WTO dispute panel and, if its complaint is upheld (by the appellant body if necessary), it can be allowed to impose sanctions on UK exports. The highly damaging effects would, most likely, make heavy inroads into UK trade, with significant impacts on GDP. One would have thought that at least one MP might have been aware of this issue, but to expect MPs actually to know anything of what they are doing seems too much to ask. And this is by no means the first time a select committee has dropped the ball. One really does wonder what the point is of having them. Gradually, though, some of the essential information is getting through. James Hookham of UK Freight Transport Association (FTA), was also giving evidence yesterday, only to the Exiting the European Union Committee. And he had got the message. Leaving the Single Market meant that checks at the point of production move to checks at the border. Attempting to assess the state of play across the EU, he had been trying to contact customs officials from different administrations. Irish border officials, he said, were being helpful but he was unable to get French customs "to pick up the phone". Hookham was looking for answers to four questions: future tariff arrangements; "conformity checks" on exported goods; whether vehicle permits would be required for trucks to cross borders; and recognition of driver qualifications across borders. Without answers, Hookham averred that keeping Britain trading might not be possible. And more particularly, he said, the free flow of goods would depend on whether the customs operations in France, Belgium, Holland and Ireland would be ready. Other witnesses were Peter Hardwick, Head of Exports, Agriculture and Horticulture Development Board, Sian Thomas, Communications Manager, Fresh Produce Consortium and Duncan Brock, CIPS Group Director, Chartered Institute of Procurement and Supply. The consistent theme was the complaint of "uncertainty", but particularly was Sian Thomas who warned that because Great Britain had been working with the EU (and its predecessors) since 1972, there was a lack of expertise on how to manage the export processes. Once again, we didn't get any sense that the MPs were getting the message, or understanding the implications of what they were told. Hookham's comments on driver qualifications (which I was writing about Companies were beginning to make decisions, and where they could they were moving production to the mainland – something which If one wanted to see evidence of the UK sliding inexorably to disaster, one just needs to look into these select committees. The issues are there, but I don't see any MPs taking them on board. In front of the committee, chaired by Conservative MP Dr Andrew Murrison, were Chloe Smith and Robin Walker, both Parliamentary Under Secretaries of State, respectively from the Northern Ireland Office and the Department for Exiting the European Union.Between them, under questioning from the chair, from Conservative MP (former Colonel) Bob Stewart and Lady Hermon (Independent), they affirmed that the UK would take no steps to harden the Northern Irish border after Brexit, even if we crash out without a deal. This is picked up by the Irish Times which quotes Walker at length."The UK would not under any circumstances want to be taking steps to harden that Border and interrupt people’s daily lives", the paper has him say. "So we will make sure that we will do everything in our power so people can go on with our daily lives and that our commitments under the Belfast Agreement are met. And whatever contingency planning the government undertakes will absolutely have those principles in mind".Colonel Bob Stewart was pretty emphatic in his line of questioning. As an officer of the 1st Cheshires, he'd done several tours in Northern Ireland at the height of the troubles, and had been hero of the Droppin Well bombing at Ballykelly in 1982.Since Colonel Bob knew that "hard borders" were indeed "hard", he didn't want to see border posts all over again. His experience of them being attacked had warned him off the idea.As far as Brexit was concerned, therefore, one way of doing it was to say that on the Northern Ireland side of the border, "there will be nothing on the border". We say to the EU, "you do what you want". We had to find a system, he said, where cars could move through the border without being stopped.Again, it was Robin Walker determined to share that vision. There would be no physical infrastructure on the border said the PUSS. "We don't believe there should be physical infrastructure on the border. We want to preserve the free movements that we have today". And that was enough for Colonel Bob. "If the European Union want to put up barricades, that's up to them", he declared.It was then the turn of the doughty Lady Hermon, she of the constituency of North Down. First elected for the Ulster Unionist Party, she had stood as an independent MP since 2010. And now she was asking the ministers how, in the event of a "no deal", you would avoid a hard border? "I need you to spell out what will happen in the event of a 'no deal'", she said.Yet again, it was for Robin Walker to do the business. "I reiterate", he said, "The UK would not under any circumstances want to take any steps to harden the border". And, to that effect, "we're not going to put up infrastructure, we're not going to do anything to harden the border".That was interesting phrasing: ""The UK would not …to take any steps to harden the border", Walker had said. That's not exactly a ringing, absolute commitment – it's more of an aspiration.Nonetheless, we can see what the line is, the "take home" message is that the UK has no intention of putting up infrastructure at the border. And without that, any attempt to control traffic at the border would result in total chaos. Without the facilities, you simply cannot manage customs checks, much less the complex sanitary and phytosanitary checks.Therein lies the enigma. The UK imports goods from all over the world and, apart from EU goods, applies border controls of varying sophistication, as well as the "official controls" on animals and foods, and other products. But once we leave the EU, to us, EU countries have to be treated the same as all other countries with which we trade, under exactly the same terms.This is a matter of WTO rules – the one's that so many "ultras" are so keen to pursue. The WTO non-discrimination requirements mean that, if we apply no checks to EU goods at the Northern Irish border, then we cannot apply them anywhere else. It really is as simple as that.Yet, here we have two ministers of the crown, and a room full of MPs, and none of them thought to mention this simple fact. They were all prepared to blather about anything under the sun, but not one seemed to be aware that what was being proposed could not be validly implemented under international trade law without us first dismantling all our other customs and sanitary controls.Furthermore, the consequences of breaching WTO rules are not to be sneezed at. Any country adversely affected can complain to the WTO dispute panel and, if its complaint is upheld (by the appellant body if necessary), it can be allowed to impose sanctions on UK exports. The highly damaging effects would, most likely, make heavy inroads into UK trade, with significant impacts on GDP.One would have thought that at least one MP might have been aware of this issue, but to expect MPs actually to know anything of what they are doing seems too much to ask. And this is by no means the first time a select committee has dropped the ball. One really does wonder what the point is of having them.Gradually, though, some of the essential information is getting through. James Hookham of UK Freight Transport Association (FTA), was also giving evidence yesterday, only to the Exiting the European Union Committee. And he had got the message. Leaving the Single Market meant that checks at the point of production move to checks at the border.Attempting to assess the state of play across the EU, he had been trying to contact customs officials from different administrations. Irish border officials, he said, were being helpful but he was unable to get French customs "to pick up the phone".Hookham was looking for answers to four questions: future tariff arrangements; "conformity checks" on exported goods; whether vehicle permits would be required for trucks to cross borders; and recognition of driver qualifications across borders. Without answers, Hookham averred that keeping Britain trading might not be possible.And more particularly, he said, the free flow of goods would depend on whether the customs operations in France, Belgium, Holland and Ireland would be ready.Other witnesses were Peter Hardwick, Head of Exports, Agriculture and Horticulture Development Board, Sian Thomas, Communications Manager, Fresh Produce Consortium and Duncan Brock, CIPS Group Director, Chartered Institute of Procurement and Supply.The consistent theme was the complaint of "uncertainty", but particularly was Sian Thomas who warned that because Great Britain had been working with the EU (and its predecessors) since 1972, there was a lack of expertise on how to manage the export processes.Once again, we didn't get any sense that the MPs were getting the message, or understanding the implications of what they were told. Hookham's comments on driver qualifications (which I was writing about in January ) were the first time I'd heard such concerns aired and the implications are dynamite. If qualifications aren't recognised, then the trucks stop moving.Companies were beginning to make decisions, and where they could they were moving production to the mainland – something which the banks are also doing.If one wanted to see evidence of the UK sliding inexorably to disaster, one just needs to look into these select committees. The issues are there, but I don't see any MPs taking them on board. No such specific announcement has been made but that nevertheless is one conclusion that could be drawn from government evidence to the Northern Ireland Affairs Committee yesterday.
// PrintWorkerStatus pretty prints a worker status. func PrintWorkerStatus(w io.Writer, workerStatus *ppsclient.WorkerStatus) { fmt.Fprintf(w, "%s\t", workerStatus.WorkerID) fmt.Fprintf(w, "%s\t", workerStatus.JobID) for _, datum := range workerStatus.Data { fmt.Fprintf(w, datum.Path) } fmt.Fprintf(w, "\t") fmt.Fprintf(w, "%s\t", pretty.Ago(workerStatus.Started)) fmt.Fprintf(w, "%d\t\n", workerStatus.QueueSize) }
The endoplasmic reticulum: a cytochemist's view (a review). Enzyme cytochemistry has been used, at the light and electron microscope levels, to "mark" cytoplasmic organelles of mammalian cells. Catalase cytochemistry permitted identification of microperoxisomes, apparently ubiquitous organelles that are attached by numerous slender connections to the endoplasmic reticulum. Thiamine pyrophosphatase and acid phosphatase cytochemistry can be used to distinguish between the Golgi apparatus and a specialized acid-phosphatase-rich region of smooth endoplasmic reticulum (ER) that appears to be involved in: (a) the formation of lysosomes and melanin granules: (b) the processing and packaging of secretory materials in endocrine and exocrine cells; and (c) the metabolism of lipid. The acronym GERL has been given to this region of smooth ER because it is located at the inner or "trans" aspect of the Golgi apparatus and because it appears to produce various types of Lysosomes.
You've already gotten peek at it... heck, if you're anything like us you've already been using the preview version of it. What are we talking about? Why the newly redesigned Gmail , of course. In late June Google started offering a vision of your web app future. It was a bit sparser, a bit more monochromatic and (dare we say) a bit more finger friendly. Well, it seems like the interface is about to become a lot less optional. A video was accidentally posted to YouTube today by Google (since pulled), offering a tour of the revamped email service. Most of it will probably look a bit familiar, but the Mountain View crew still has a few tricks left up its sleeve. For instance conversation views now more closely resemble IMs (with profile pictures) and the advanced search options are more easily accessible and prominently displayed. The themes are also getting updated with higher resolution wallpapers to better match the spartan UI. Not that you need any encouragement, but you should definitely check out the video after the break.
Book Review: Ruth Levitas, Utopia as Method: The Imaginary Reconstitution of Society (p. 185) and this rather glosses over internal debates and divisions over strategy and tactics. This potential limitation could be discussed in order to explore why (as Castells shows by citing public opinion polls), in Spain in particular, the protests gained huge public support, but did not generate a widespread belief that anything lasting would be achieved. This issue is sidestepped by Castells who recognises the very limited tangible reforms, but asserts the expressive above the instrumental element of the movements, whose main achievement and enduring goal remains the process of raising consciousness and participatory deliberation (p. 125) in order to refound democracy. So the presentation of these movements focuses mainly on the message of democratisation and thereby is stripped of tangible economic and social substance. The practices of deliberation in the public assemblies that governed the occupations are described in detail, but there is little or nothing on the concrete proposals or broader visions of how the movements seek to address the pressing economic and social problems facing the participants and broader public. The discussion chapter titled Changing the World in the Network Society identifies more than a dozen common characteristics of these diverse movements to develop a model of contemporary social movements. Again this threatens to deny real differences within the movements, for example over the issue of non-violence, which Castells asserts as a principle. It also generalises from movements at an early stage of the protest cycle to link this model to Castells overarching theory of the network society in which the internet and social movements share the culture of autonomy (p. 230) that characterises the epoch. The very brief concluding chapter, Beyond Outrage, Hope, reasserts that the implicit project of the movements is to reformulate democracy and so rehumanise the economy and society. As Castells denies the anti-capitalist orientation of the movements and rejects socialism as an outdated ideology, this proves to be a self-limiting radicalism that leaves capitalism and representative democracy intact. In essence this analysis recuperates the protests as agents of a reformist project that becomes his version of changing society (and for Castells the state) without taking power. For Castells, the key agent of this project of civilising informational capitalism is the technically savvy, highly educated, young middle class whose creativity has been stifled by short-sighted elites. This group has been prominent in the protests, but the relative absence or moderation of the organised working class, largely ignored by Castells, may explain the relative lack of success in delivering radical economic and social reforms.
<reponame>shurcooL/home<filename>internal/exp/service/notification/httphandler/httphandler.go // Package httphandler contains an API handler for notification.Service. package httphandler import ( "encoding/json" "fmt" "net/http" "strconv" "github.com/shurcooL/home/internal/exp/service/notification" "github.com/shurcooL/httperror" ) // Notification is an API handler for notification.Service. // It returns errors compatible with httperror package. type Notification struct { Notification notification.Service } func (h Notification) ListNotifications(w http.ResponseWriter, req *http.Request) error { if req.Method != http.MethodGet { return httperror.Method{Allowed: []string{http.MethodGet}} } var opt notification.ListOptions // TODO: Automate this conversion process. opt.Namespace = req.URL.Query().Get("Namespace") opt.All, _ = strconv.ParseBool(req.URL.Query().Get("All")) notifs, err := h.Notification.ListNotifications(req.Context(), opt) return httperror.JSONResponse{V: struct { Notifs []notification.Notification Error errorJSON }{notifs, errorJSON{err}}} } func (h Notification) StreamNotifications(w http.ResponseWriter, req *http.Request) error { if req.Method != http.MethodGet { return httperror.Method{Allowed: []string{http.MethodGet}} } fl, ok := w.(http.Flusher) if !ok { return fmt.Errorf("http.ResponseWriter %T is not a http.Flusher", w) } ch := make(chan []notification.Notification, 8) err := h.Notification.StreamNotifications(req.Context(), ch) if err != nil { return err } w.Header().Set("Content-Type", "application/json") w.Header().Set("X-Content-Type-Options", "nosniff") enc := json.NewEncoder(w) enc.SetIndent("", "\t") for { select { case <-req.Context().Done(): return req.Context().Err() case notifs := <-ch: err := enc.Encode(notifs) if err != nil { return err } fl.Flush() } } } func (h Notification) CountNotifications(w http.ResponseWriter, req *http.Request) error { if req.Method != http.MethodGet { return httperror.Method{Allowed: []string{http.MethodGet}} } c, err := h.Notification.CountNotifications(req.Context()) return httperror.JSONResponse{V: struct { Count uint64 Error errorJSON }{c, errorJSON{err}}} } func (h Notification) MarkThreadRead(w http.ResponseWriter, req *http.Request) error { if req.Method != http.MethodPost { return httperror.Method{Allowed: []string{http.MethodPost}} } q := req.URL.Query() // TODO: Automate this conversion process. namespace := q.Get("Namespace") threadType := q.Get("ThreadType") threadID, err := strconv.ParseUint(q.Get("ThreadID"), 10, 64) if err != nil { return httperror.BadRequest{Err: fmt.Errorf("parsing ThreadID query parameter: %v", err)} } err = h.Notification.MarkThreadRead(req.Context(), namespace, threadType, threadID) return err } // errorJSON marshals an error value into JSON. // // A nil Err value is encoded as the null JSON value, otherwise // the string returned by the Error method is encoded as a JSON string. type errorJSON struct { Err error } // MarshalJSON implements the json.Marshaler interface. func (e errorJSON) MarshalJSON() ([]byte, error) { if e.Err == nil { return []byte("null"), nil } return json.Marshal(e.Err.Error()) }
// SetRuleExceptions add exceptions to rule report func SetRuleExceptions(ruleReport *reporthandling.RuleReport, exceptionsPolicies []armotypes.PostureExceptionPolicy, clusterName, frameworkName, controlName, controlID string) { ruleExceptions := ListRuleExceptions(exceptionsPolicies, frameworkName, controlName, controlID, ruleReport.Name) SetRuleResponsExceptions(ruleReport.RuleResponses, ruleExceptions, clusterName) }
<reponame>Seanghost117/GTA-V-Decompiled-Scripts<gh_stars>0 #region Local Var var uLocal_0 = 0; var uLocal_1 = 0; int iLocal_2 = 0; int iLocal_3 = 0; int iLocal_4 = 0; int iLocal_5 = 0; int iLocal_6 = 0; int iLocal_7 = 0; int iLocal_8 = 0; int iLocal_9 = 0; int iLocal_10 = 0; int iLocal_11 = 0; var uLocal_12 = 0; var uLocal_13 = 0; float fLocal_14 = 0f; var uLocal_15 = 0; var uLocal_16 = 0; int iLocal_17 = 0; var uLocal_18 = 0; var uLocal_19 = 0; char* sLocal_20 = NULL; var uLocal_21 = 0; var uLocal_22 = 0; float fLocal_23 = 0f; float fLocal_24 = 0f; float fLocal_25 = 0f; var uLocal_26 = 0; var uLocal_27 = 0; float fLocal_28 = 0f; var uLocal_29 = 0; var uLocal_30 = 0; var uLocal_31 = 0; float fLocal_32 = 0f; float fLocal_33 = 0f; var uLocal_34 = 0; var uLocal_35 = 0; int iLocal_36 = 0; var uLocal_37 = 0; var uLocal_38 = 0; var uLocal_39 = 0; int iLocal_40 = 0; int iLocal_41 = 0; int iLocal_42 = 0; int iLocal_43 = 0; var uLocal_44 = 0; var uLocal_45 = 0; var uLocal_46 = 0; var uLocal_47 = 0; var uLocal_48 = 0; var uLocal_49 = 0; var uLocal_50 = 0; var uLocal_51 = 0; var uLocal_52 = 0; var uLocal_53 = 0; var uLocal_54 = 0; var uLocal_55 = 0; var uLocal_56 = 0; var uLocal_57 = 0; var uLocal_58 = 0; var uLocal_59 = 0; var uLocal_60 = 0; var uLocal_61 = 0; var uLocal_62 = 0; var uLocal_63 = 0; var uLocal_64 = 0; var uLocal_65 = 0; struct<3> Local_66 = { 0, 0, 0 } ; int iLocal_67 = 0; int iLocal_68 = 0; int iLocal_69 = 0; var uLocal_70 = 0; struct<215> Local_71 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1056964608, 1084227584, 0, 1109393408, 0, 0, 1125515264, 0, 0, 0, 0, 0, 0, 0, 1065848144, 1074048008, 1073959928, 1077206319, -1033122611, -1055016354, 0, 0, 0, 0, 0, 0, 1105199104, 1092616192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1101004800, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, 0, 0 } ; var uLocal_72 = 0; var uLocal_73 = 0; struct<2> Local_74 = { 0, 0 } ; var uLocal_75 = 0; var uLocal_76 = 0; int iLocal_77 = 0; int iLocal_78 = 0; int iLocal_79 = 0; int iLocal_80 = 0; bool bLocal_81 = 0; int iLocal_82 = 0; int iLocal_83 = 0; bool bLocal_84 = 0; bool bLocal_85 = 0; bool bLocal_86 = 0; int iLocal_87 = 0; int iLocal_88 = 0; bool bLocal_89 = 0; bool bLocal_90 = 0; bool bLocal_91 = 0; bool bLocal_92 = 0; int iLocal_93 = 0; bool bLocal_94 = 0; int iLocal_95 = 0; float fLocal_96 = 0f; int iLocal_97 = 0; bool bLocal_98 = 0; bool bLocal_99 = 0; int iLocal_100 = 0; int iLocal_101 = 0; bool bLocal_102 = 0; bool bLocal_103 = 0; int iLocal_104 = 0; var uLocal_105 = 0; var uLocal_106 = 0; var uLocal_107 = 0; var uLocal_108 = 0; int iLocal_109 = 0; int iLocal_110 = 0; int iLocal_111 = 0; int iLocal_112 = 0; int iLocal_113 = 0; int iLocal_114 = 0; int iLocal_115 = 0; struct<3> Local_116 = { 0, 0, 0 } ; float fLocal_117 = 0f; int iLocal_118 = 0; int iLocal_119 = 0; int iLocal_120 = 0; int iLocal_121 = 0; int iLocal_122 = 0; int iLocal_123 = 0; int iLocal_124 = 0; int iLocal_125 = 0; int iLocal_126 = 0; int iLocal_127 = 0; var uLocal_128 = 0; var uLocal_129 = 0; int iLocal_130 = 0; struct<2> Local_131[2]; bool bLocal_132 = 0; int iLocal_133 = 0; int iLocal_134 = 0; var uLocal_135 = 0; var uLocal_136 = 0; int iLocal_137 = 0; struct<21> Local_138 = { 0, -1, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, -1 } ; #endregion void __EntryFunction__() { iLocal_2 = 1; iLocal_3 = 134; iLocal_4 = 134; iLocal_5 = 1; iLocal_6 = 1; iLocal_7 = 1; iLocal_8 = 134; iLocal_9 = 1; iLocal_10 = 12; iLocal_11 = 12; fLocal_14 = 0.001f; iLocal_17 = -1; sLocal_20 = "NULL"; fLocal_23 = 80f; fLocal_24 = 140f; fLocal_25 = 180f; fLocal_28 = 0f; fLocal_32 = -0.0375f; fLocal_33 = 0.17f; iLocal_36 = 3; iLocal_40 = 1; iLocal_41 = 65; iLocal_42 = 49; iLocal_43 = 64; fLocal_96 = 0.1f; iLocal_111 = -2; Local_116 = { 0.1f, 0.1f, 0.1f }; fLocal_117 = 0f; if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { func_226(ScriptParam_138); } while (true) { func_225(); if (func_215()) { func_210(); } func_208(); if (func_195()) { func_210(); } func_194(&uLocal_72, 0, 0); if (func_193(PLAYER::PLAYER_ID())) { HUD::SHOW_HUD_COMPONENT_THIS_FRAME(1); } if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS() && NETWORK::PARTICIPANT_ID_TO_INT() != -1) { switch (Local_131[NETWORK::PARTICIPANT_ID_TO_INT() /*2*/]) { case 0: func_192(1); break; case 1: if ((func_191(iLocal_120) && !PED::IS_PED_INJURED(PLAYER::PLAYER_PED_ID())) && PED::GET_PED_CONFIG_FLAG(PLAYER::PLAYER_PED_ID(), 184, true) != Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_732) { if (!MISC::IS_BIT_SET(iLocal_113, 0)) { MISC::SET_BIT(&iLocal_113, 0); if (PED::GET_PED_CONFIG_FLAG(PLAYER::PLAYER_PED_ID(), 184, true)) { MISC::SET_BIT(&iLocal_113, 1); } } if (!Global_1573984) { PED::SET_PED_CONFIG_FLAG(PLAYER::PLAYER_PED_ID(), 184, Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_732); } } func_1(); Global_2462227 = 0; if (iLocal_130 >= 3) { func_192(3); } break; case 2: break; case 3: func_210(); break; default: break; } } if (NETWORK::NETWORK_IS_HOST_OF_THIS_SCRIPT()) { switch (iLocal_130) { case 0: iLocal_130 = 1; break; case 1: break; case 2: break; case 3: func_210(); break; default: break; } } } } void func_1() { struct<3> Var0; float fVar1; struct<3> Var2; float fVar3; struct<3> Var4; float fVar5; float fVar6; struct<3> Var7; int iVar8; int iVar9; func_190(); func_188(); func_187(); func_186(); if (((VEHICLE::IS_VEHICLE_DRIVEABLE(iLocal_120, false) && NETWORK::_0x21D04D7BC538C146(iLocal_120)) && !func_185(PLAYER::PLAYER_ID()) == 129) && (((bLocal_84 || bLocal_85) || bLocal_86) || Global_1319116 != -1)) { func_184(); bLocal_81 = true; } else { bLocal_81 = false; } Global_1573326 = 0; func_183(); func_182(); if (func_181(&Local_71)) { if (!iLocal_95 && func_180()) { AUDIO::SET_AUDIO_FLAG("ForceSniperAudio", true); iLocal_95 = 1; } } else if (iLocal_95) { AUDIO::SET_AUDIO_FLAG("ForceSniperAudio", false); iLocal_95 = 0; } if (MISC::IS_BIT_SET(Global_4456448.f_226417, 1)) { if (iLocal_124 == PLAYER::PLAYER_ID()) { if (!iLocal_93) { VEHICLE::DISABLE_VEHICLE_WEAPON(true, joaat("vehicle_weapon_space_rocket"), iLocal_120, PLAYER::PLAYER_PED_ID()); iLocal_93 = 1; } } } else if (func_179()) { if (iLocal_124 == PLAYER::PLAYER_ID()) { if (!iLocal_93 && iLocal_78 != joaat("hunter")) { VEHICLE::DISABLE_VEHICLE_WEAPON(true, joaat("vehicle_weapon_space_rocket"), iLocal_120, PLAYER::PLAYER_PED_ID()); iLocal_93 = 1; } } } else if (iLocal_124 == PLAYER::PLAYER_ID()) { if (iLocal_93) { VEHICLE::DISABLE_VEHICLE_WEAPON(false, joaat("vehicle_weapon_space_rocket"), iLocal_120, PLAYER::PLAYER_PED_ID()); iLocal_93 = 0; } } func_177(); func_175(); func_173(); switch (Local_131[NETWORK::PARTICIPANT_ID_TO_INT() /*2*/].f_1) { case 0: func_172(); func_164(); func_161(); Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_732 = 0; Global_1573326 = 0; if (func_150()) { func_149(1); } else if ((bLocal_84 || bLocal_85) || bLocal_86) { if (func_148(iLocal_120)) { PAD::DISABLE_CONTROL_ACTION(0, 24, true); PAD::DISABLE_CONTROL_ACTION(0, 66, true); PAD::DISABLE_CONTROL_ACTION(0, 67, true); PAD::DISABLE_CONTROL_ACTION(0, 68, true); PAD::DISABLE_CONTROL_ACTION(0, 114, true); PAD::DISABLE_CONTROL_ACTION(0, 69, true); PAD::DISABLE_CONTROL_ACTION(0, 70, true); PAD::DISABLE_CONTROL_ACTION(0, 91, true); PAD::DISABLE_CONTROL_ACTION(0, 92, true); PAD::DISABLE_CONTROL_ACTION(0, 99, true); PAD::DISABLE_CONTROL_ACTION(0, 100, true); PAD::DISABLE_CONTROL_ACTION(0, 37, true); } } func_147(&uLocal_75); break; case 1: func_146(); func_145(1); if (Global_1319116 != -1) { func_147(&uLocal_75); func_144(&uLocal_75, 0, 0); } if (Global_1319110 != -1 || Global_1319116 != -1) { CAM::DO_SCREEN_FADE_OUT(250); iLocal_69 = unk_0x67D02A194A2FC2BD(func_143()); if (Local_71.f_214) { Local_71.f_214 = 0; } if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { if (PLAYER::GET_MAX_WANTED_LEVEL() > 0) { PLAYER::SET_WANTED_LEVEL_MULTIPLIER(0.65f); iLocal_77 = 1; } } if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { if (PLAYER::GET_MAX_WANTED_LEVEL() > 0) { PLAYER::SET_WANTED_LEVEL_MULTIPLIER(Global_262145.f_22581); iLocal_77 = 1; } } } else if (func_191(iLocal_120)) { iLocal_69 = unk_0x67D02A194A2FC2BD(func_143()); } else { iLocal_69 = unk_0x67D02A194A2FC2BD(func_143()); } GRAPHICS::REQUEST_STREAMED_TEXTURE_DICT("helicopterhud", false); func_139(); if ((func_138(&Local_71, 0) && GRAPHICS::HAS_SCALEFORM_MOVIE_LOADED(iLocal_69)) && GRAPHICS::HAS_STREAMED_TEXTURE_DICT_LOADED("helicopterhud")) { if (Global_2461147) { if (STREAMING::IS_NEW_LOAD_SCENE_ACTIVE() == 0 || STREAMING::IS_NEW_LOAD_SCENE_LOADED()) { STREAMING::NEW_LOAD_SCENE_STOP(); } if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID())) { if (STREAMING::IS_ENTITY_FOCUS(PLAYER::PLAYER_PED_ID())) { STREAMING::CLEAR_FOCUS(); } } } Local_71.f_9 = func_137(iLocal_120); Local_71.f_4 = 1; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_732 = 1; func_135(&Local_71, iLocal_120, 1, iLocal_120, 1); Global_2547057 = 1; func_133(); ENTITY::SET_ENTITY_ALWAYS_PRERENDER(iLocal_120, true); func_149(2); if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol")) { GRAPHICS::SET_PARTICLE_FX_OVERRIDE("muz_xm_volatol_twinmg", "scr_xm_volatol_turret_camera"); } if (((!bLocal_84 && !bLocal_85) && !bLocal_86) && Global_1319116 == -1) { Local_71.f_7 = 1; func_130(); } if (!(Global_1319110 != -1 || Global_1319116 != -1)) { func_129(); } } func_128(); break; case 2: if ((Global_1319110 != -1 || Global_1319116 != -1) || func_191(iLocal_120)) { func_127(); } if ((MISC::GET_FRAME_COUNT() % 30) == 0) { Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_848 = { CAM::GET_FINAL_RENDERED_CAM_COORD() }; } iLocal_79 = joaat("w_lr_rpg_rocket"); if (iLocal_79 != 0) { STREAMING::REQUEST_MODEL(iLocal_79); } if ((Global_1319110 != -1 || func_191(iLocal_120)) || Global_1319116 != -1) { INTERIOR::_0x483ACA1176CA93F1(); func_126(&Local_71, 0); if (Local_71.f_212 && Local_71.f_213) { CAM::RENDER_SCRIPT_CAMS(true, false, 3000, true, false, 0); Local_71.f_213 = 0; GRAPHICS::SET_TIMECYCLE_MODIFIER("eyeinthesky"); if (func_125()) { func_144(&uLocal_128, 0, 0); } return; } if (!Local_71.f_212) { Local_71.f_42 = { CAM::GET_CAM_ROT(Local_71.f_32, 2) }; Local_71.f_212 = 1; return; } if (Local_71.f_213) { return; } else if (!Global_76890 || func_124(3)) { if (CAM::IS_SCREEN_FADED_OUT()) { if (!func_125()) { CAM::DO_SCREEN_FADE_IN(250); } else if (func_123(iLocal_120)) { if (func_122(&uLocal_128) && func_121(&uLocal_128, 3000, 0)) { func_147(&uLocal_128); CAM::DO_SCREEN_FADE_IN(250); } } } } } if (func_120()) { GRAPHICS::SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED(&iLocal_69); } else if (!GRAPHICS::HAS_SCALEFORM_MOVIE_LOADED(iLocal_69)) { iLocal_69 = unk_0x67D02A194A2FC2BD(func_143()); } func_139(); func_114(0); func_126(&Local_71, 1); Local_71.f_4 = 1; if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("avenger")) { if (CAM::DOES_CAM_EXIST(Local_71.f_32)) { fVar1 = Local_71.f_40; fVar1 = (fVar1 + 5f); CAM::SET_CAM_FOV(Local_71.f_32, fVar1); } STREAMING::_0x472397322E92A856(); } if (func_113(iLocal_120) || func_112()) { PAD::DISABLE_CONTROL_ACTION(0, 91, true); PAD::DISABLE_CONTROL_ACTION(0, 92, true); } PAD::DISABLE_CONTROL_ACTION(0, 91, true); PAD::DISABLE_CONTROL_ACTION(0, 68, true); PAD::DISABLE_CONTROL_ACTION(0, 69, true); PAD::DISABLE_CONTROL_ACTION(0, 80, true); PAD::DISABLE_CONTROL_ACTION(0, 65, true); PAD::DISABLE_CONTROL_ACTION(0, 99, true); PAD::DISABLE_CONTROL_ACTION(0, 100, true); PAD::DISABLE_CONTROL_ACTION(1, 1, true); PAD::DISABLE_CONTROL_ACTION(1, 2, true); PAD::DISABLE_CONTROL_ACTION(0, 37, true); if ((bLocal_84 || bLocal_85) || bLocal_86) { PAD::DISABLE_CONTROL_ACTION(1, 85, true); } func_108(); func_107(); func_129(); if (Global_1319110 != -1) { if (!Global_1319111) { Global_1319111 = 1; } Local_71.f_25 = 50f; if (Global_1319110 == 1) { func_83(&Local_71, 0, 30f, -12f, -50f, 50f, 1041865114); } else if (Global_1319110 == 2) { func_83(&Local_71, 0, 30f, -55f, -85f, 140f, 1041865114); } else if (Global_1319110 == 3) { func_83(&Local_71, 0, 30f, -55f, -140f, 85f, 1041865114); } else { func_83(&Local_71, 0, 1086324736, -1030356992, -1020002304, 1127481344, 1041865114); } Var0 = { CAM::GET_FINAL_RENDERED_CAM_COORD() }; if ((((HUD::IS_PAUSE_MENU_ACTIVE() || func_120()) || PAD::IS_CONTROL_JUST_PRESSED(2, 199)) || PAD::IS_CONTROL_PRESSED(2, 199)) || PAD::IS_CONTROL_JUST_RELEASED(2, 199)) { HUD::_SET_PLAYER_BLIP_POSITION_THIS_FRAME(Var0.x, Var0.f_1); if (HUD::IS_PAUSE_MENU_ACTIVE() || func_120()) { if (HUD::DOES_BLIP_EXIST(HUD::GET_MAIN_PLAYER_BLIP_ID())) { HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255); } } } else if (HUD::DOES_BLIP_EXIST(HUD::GET_MAIN_PLAYER_BLIP_ID())) { HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 0); } HUD::LOCK_MINIMAP_POSITION(Var0.x, Var0.f_1); HUD::SET_RADAR_AS_EXTERIOR_THIS_FRAME(); HUD::HIDE_MINIMAP_INTERIOR_MAP_THIS_FRAME(); HUD::SET_RADAR_ZOOM(0); Var2 = { CAM::GET_FINAL_RENDERED_CAM_ROT(0) }; Var2 = { func_82(Var2) }; if (!HUD::DOES_BLIP_EXIST(iLocal_126)) { iLocal_127 = func_80(Var0, 0); HUD::SET_BLIP_SPRITE(iLocal_127, 425); HUD::SHOW_HEIGHT_ON_BLIP(iLocal_127, false); HUD::SET_BLIP_DISPLAY(iLocal_127, 4); HUD::SET_BLIP_COLOUR(iLocal_127, func_79(2)); HUD::SET_BLIP_SHOW_CONE(iLocal_127, true); HUD::SET_BLIP_SCALE(iLocal_127, 0.54f); HUD::SET_BLIP_PRIORITY(iLocal_127, 13 + 1); iLocal_126 = func_80(Var0, 0); HUD::SET_BLIP_SPRITE(iLocal_126, 425); HUD::SHOW_HEIGHT_ON_BLIP(iLocal_126, false); HUD::SET_BLIP_DISPLAY(iLocal_126, 4); HUD::SET_BLIP_COLOUR(iLocal_126, func_79(18)); HUD::SET_BLIP_SHOW_CONE(iLocal_126, true); HUD::SET_BLIP_SCALE(iLocal_126, 0.44f); HUD::SET_BLIP_PRIORITY(iLocal_126, 13 + 1); HUD::SET_BLIP_HIDDEN_ON_LEGEND(iLocal_126, true); HUD::SET_BLIP_ROTATION(iLocal_126, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var2.x, Var2.f_1))); HUD::SET_BLIP_HIDDEN_ON_LEGEND(iLocal_127, true); HUD::SET_BLIP_ROTATION(iLocal_127, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var2.x, Var2.f_1))); } else { HUD::SET_BLIP_COORDS(iLocal_126, Var0); HUD::SET_BLIP_ROTATION(iLocal_126, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var2.x, Var2.f_1))); HUD::SET_BLIP_DISPLAY(iLocal_126, 5); HUD::SET_BLIP_COORDS(iLocal_127, Var0); HUD::SET_BLIP_ROTATION(iLocal_127, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var2.x, Var2.f_1))); HUD::SET_BLIP_DISPLAY(iLocal_127, 5); } } else if (func_191(iLocal_120)) { Local_71.f_36 = 0.002f; if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula")) { switch (func_78()) { case 0: Local_71.f_25 = 180f; func_83(&Local_71, 0, 10f, -70f, -100f, 100f, fLocal_96); break; case 1: Local_71.f_25 = 170f; func_83(&Local_71, 0, 16.5f, -70f, -180f, 180f, fLocal_96); break; case 2: Local_71.f_25 = 170f; func_83(&Local_71, 0, 16.5f, -70f, -180f, 180f, fLocal_96); break; default: Local_71.f_25 = 360f; func_83(&Local_71, 0, 54f, -12f, -50f, 50f, fLocal_96); break; } } else if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol")) { if (!MISC::GET_GROUND_Z_FOR_3D_COORD(ENTITY::GET_ENTITY_COORDS(iLocal_120, true), &fVar3, true, false)) { fVar3 = -1000f; } Var4 = { ENTITY::GET_ENTITY_COORDS(iLocal_120, true) }; fVar5 = (Var4.f_2 - fVar3); fVar6 = func_77(((Local_71.f_40 - Local_71.f_39) / (Local_71.f_38 - Local_71.f_39)), 0f, 1f); Local_71.f_39 = func_76(10f, 27.9f, (1f - func_77(((fVar5 - 2f) / 40f), 0f, 1f))); Local_71.f_40 = func_76(Local_71.f_39, Local_71.f_38, fVar6); switch (func_78()) { case 1: Local_71.f_25 = 360f; func_83(&Local_71, 0, 6.5f, -70f, -100f, 100f, fLocal_96); break; case 2: Local_71.f_25 = 360f; func_83(&Local_71, 0, 50f, 5f, -100f, 100f, fLocal_96); break; default: Local_71.f_25 = 360f; func_83(&Local_71, 0, 54f, -12f, -50f, 50f, fLocal_96); break; } } else { switch (func_78()) { case 1: Local_71.f_25 = 360f; func_83(&Local_71, 0, 13f, -80f, -50f, 50f, fLocal_96); break; case 0: Local_71.f_25 = 360f; func_83(&Local_71, 0, 54f, -12f, -50f, 50f, fLocal_96); break; case 2: Local_71.f_25 = 70f; func_83(&Local_71, 0, 48f, -45f, -100f, 100f, fLocal_96); break; default: Local_71.f_25 = 360f; func_83(&Local_71, 0, 54f, -12f, -50f, 50f, fLocal_96); break; } } } else if (Global_1319116 != -1) { Local_71.f_36 = 0.002f; if (!func_124(3)) { if (!Global_1319111) { Global_1319111 = 1; } } if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { switch (Global_1319116) { case 1: Local_71.f_25 = 360f; func_83(&Local_71, 0, 15f, -80f, -100f, 100f, fLocal_96); break; case 2: Local_71.f_25 = 360f; func_83(&Local_71, 0, 80f, -20f, -100f, 100f, fLocal_96); break; case 3: Local_71.f_25 = 360f; func_83(&Local_71, 0, 15f, -80f, -100f, 100f, fLocal_96); break; default: Local_71.f_25 = 360f; func_83(&Local_71, 0, 54f, -80f, -50f, 50f, fLocal_96); break; } } else if (!func_75(PLAYER::PLAYER_ID()) && !func_124(3)) { switch (Global_1319116) { case 1: Local_71.f_25 = 360f; func_83(&Local_71, 0, 13f, -80f, -50f, 50f, fLocal_96); break; case 0: Local_71.f_25 = 360f; func_83(&Local_71, 0, 54f, -80f, -50f, 50f, fLocal_96); break; case 2: Local_71.f_25 = 70f; func_83(&Local_71, 0, 48f, -80f, -100f, 100f, fLocal_96); break; default: Local_71.f_25 = 360f; func_83(&Local_71, 0, 54f, -80f, -50f, 50f, fLocal_96); break; } } else if (func_124(3)) { switch (Global_1319116) { case 1: Local_71.f_25 = 360f; func_83(&Local_71, 0, 88f, -80f, -100f, 100f, fLocal_96); break; case 0: Local_71.f_25 = 360f; func_83(&Local_71, 0, 88f, -80f, -100f, 100f, fLocal_96); break; case 2: Local_71.f_25 = 360f; func_83(&Local_71, 0, 88f, -80f, -100f, 100f, fLocal_96); break; default: Local_71.f_25 = 360f; func_83(&Local_71, 0, 88f, -80f, -100f, 100f, fLocal_96); break; } } else { switch (Global_1319116) { case 1: Local_71.f_25 = 360f; func_83(&Local_71, 0, 13f, -80f, -50f, 50f, fLocal_96); break; case 0: Local_71.f_25 = 360f; func_83(&Local_71, 0, 13f, -80f, -50f, 50f, fLocal_96); break; case 2: Local_71.f_25 = 360f; func_83(&Local_71, 0, 13f, -80f, -50f, 50f, fLocal_96); break; default: Local_71.f_25 = 360f; func_83(&Local_71, 0, 13f, -80f, -50f, 50f, fLocal_96); break; } } Var0 = { CAM::GET_FINAL_RENDERED_CAM_COORD() }; if ((((HUD::IS_PAUSE_MENU_ACTIVE() || func_120()) || PAD::IS_CONTROL_JUST_PRESSED(2, 199)) || PAD::IS_CONTROL_PRESSED(2, 199)) || PAD::IS_CONTROL_JUST_RELEASED(2, 199)) { HUD::_SET_PLAYER_BLIP_POSITION_THIS_FRAME(Var0.x, Var0.f_1); if (HUD::IS_PAUSE_MENU_ACTIVE() || func_120()) { if (HUD::DOES_BLIP_EXIST(HUD::GET_MAIN_PLAYER_BLIP_ID())) { HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255); } } } else if (HUD::DOES_BLIP_EXIST(HUD::GET_MAIN_PLAYER_BLIP_ID())) { HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 0); } HUD::LOCK_MINIMAP_POSITION(Var0.x, Var0.f_1); HUD::SET_RADAR_AS_EXTERIOR_THIS_FRAME(); HUD::HIDE_MINIMAP_INTERIOR_MAP_THIS_FRAME(); HUD::SET_RADAR_ZOOM(0); Var7 = { CAM::GET_FINAL_RENDERED_CAM_ROT(0) }; Var7 = { func_82(Var7) }; if (!HUD::DOES_BLIP_EXIST(iLocal_126)) { iLocal_127 = func_80(Var0, 0); HUD::SET_BLIP_SPRITE(iLocal_127, 425); HUD::SHOW_HEIGHT_ON_BLIP(iLocal_127, false); HUD::SET_BLIP_DISPLAY(iLocal_127, 4); HUD::SET_BLIP_COLOUR(iLocal_127, func_79(2)); HUD::SET_BLIP_SHOW_CONE(iLocal_127, true); HUD::SET_BLIP_SCALE(iLocal_127, 0.54f); HUD::SET_BLIP_PRIORITY(iLocal_127, 13 + 1); iLocal_126 = func_80(Var0, 0); HUD::SET_BLIP_SPRITE(iLocal_126, 425); HUD::SHOW_HEIGHT_ON_BLIP(iLocal_126, false); HUD::SET_BLIP_DISPLAY(iLocal_126, 4); HUD::SET_BLIP_COLOUR(iLocal_126, func_79(18)); HUD::SET_BLIP_SHOW_CONE(iLocal_126, true); HUD::SET_BLIP_SCALE(iLocal_126, 0.44f); HUD::SET_BLIP_PRIORITY(iLocal_126, 13 + 1); HUD::SET_BLIP_HIDDEN_ON_LEGEND(iLocal_126, true); HUD::SET_BLIP_ROTATION(iLocal_126, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var7.x, Var7.f_1))); HUD::SET_BLIP_HIDDEN_ON_LEGEND(iLocal_127, true); HUD::SET_BLIP_ROTATION(iLocal_127, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var7.x, Var7.f_1))); } else { HUD::SET_BLIP_COORDS(iLocal_126, Var0); HUD::SET_BLIP_ROTATION(iLocal_126, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var7.x, Var7.f_1))); HUD::SET_BLIP_DISPLAY(iLocal_126, 5); HUD::SET_BLIP_COORDS(iLocal_127, Var0); HUD::SET_BLIP_ROTATION(iLocal_127, SYSTEM::ROUND(MISC::GET_HEADING_FROM_VECTOR_2D(Var7.x, Var7.f_1))); HUD::SET_BLIP_DISPLAY(iLocal_127, 5); } } else { Local_71.f_25 = 90f; func_83(&Local_71, 0, 1086324736, -1030356992, -1020002304, 1127481344, 1041865114); } func_72(); Local_71.f_87 = 1; if (Local_71.f_34) { if (Global_1319116 != -1) { func_149(0); Local_71.f_34 = 0; if (Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_847) { HUD::UNLOCK_MINIMAP_POSITION(); } Global_2513487 = 0; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_847 = 0; func_70(); } else { func_210(); } } if (((((!bLocal_84 && !bLocal_85) && !bLocal_86) && iLocal_78 != joaat("hunter")) && iLocal_78 != joaat("akula")) && Global_1319116 == -1) { Local_71.f_7 = 1; func_130(); } if (((bLocal_84 || bLocal_85) || bLocal_86) || func_112()) { func_57(); if (iLocal_78 != joaat("bombushka")) { func_46(); } } if (bLocal_132) { if (func_191(iLocal_120)) { PAD::DISABLE_CONTROL_ACTION(0, 75, true); } } if (((((!HUD::IS_PAUSE_MENU_ACTIVE() && !func_45()) && !func_44(0)) && !HUD::IS_WARNING_MESSAGE_ACTIVE()) || ((Global_1319110 != -1 && func_43(Global_1590374)) && !NETWORK::NETWORK_IS_ACTIVITY_SESSION())) || ((Global_1319116 != -1 && func_43(Global_1590374)) && !NETWORK::NETWORK_IS_ACTIVITY_SESSION())) { iVar8 = 51; iVar9 = 0; if (Global_1319110 != -1 || Global_1319116 != -1) { iVar9 = 2; iVar8 = 225; } if (func_191(iLocal_120)) { iVar9 = 2; iVar8 = 225; PAD::DISABLE_CONTROL_ACTION(0, 80, true); } if ((((PAD::IS_CONTROL_JUST_PRESSED(iVar9, iVar8) || !VEHICLE::IS_VEHICLE_DRIVEABLE(iLocal_120, false)) || func_42(iLocal_120, 0)) || func_41("HUNTGUN_T_3")) || func_27()) { iLocal_80 = 0; if (func_191(iLocal_120)) { func_144(&uLocal_107, 1, 0); Global_1319117 = 1; } if (HUD::DOES_BLIP_EXIST(iLocal_126)) { HUD::REMOVE_BLIP(&iLocal_126); } if (HUD::DOES_BLIP_EXIST(iLocal_127)) { HUD::REMOVE_BLIP(&iLocal_127); } if (HUD::DOES_BLIP_EXIST(HUD::GET_MAIN_PLAYER_BLIP_ID())) { HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255); } CAM::SET_GAMEPLAY_CAM_RELATIVE_HEADING(0f); CAM::SET_GAMEPLAY_CAM_RELATIVE_PITCH(-7f, 1f); if (Global_1319110 != -1 || Global_1319116 != -1) { Global_1319111 = 0; func_70(); if (func_41(func_9(iLocal_120))) { HUD::CLEAR_HELP(true); } CAM::DO_SCREEN_FADE_OUT(0); Global_2513487 = 0; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_847 = 0; Global_2513488 = 1; func_149(0); Var0 = { func_8(PLAYER::PLAYER_ID()) }; if (!func_7(Var0)) { HUD::_SET_PLAYER_BLIP_POSITION_THIS_FRAME(Var0.x, Var0.f_1); } HUD::UNLOCK_MINIMAP_POSITION(); } else if (func_191(iLocal_120)) { func_149(0); func_70(); PAD::DISABLE_CONTROL_ACTION(0, 80, true); } else { func_192(3); } Global_1676377.f_3320 = 0; } } break; } func_2(); } void func_2() { int iVar0; bool bVar1; iVar0 = 0; bVar1 = Global_1590535[PLAYER::GET_PLAYER_INDEX() /*876*/].f_732; if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { if (bVar1) { iVar0 = 1; } else if (func_6()) { iVar0 = 2; } } else if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { if (bVar1) { iVar0 = 3; } else if (func_6()) { iVar0 = 4; } } else if (func_124(3)) { iVar0 = 5; } if (iVar0 != iLocal_114) { if (iLocal_114 != 0) { AUDIO::STOP_AUDIO_SCENE(func_5(iLocal_114)); } if (iVar0 != 0) { AUDIO::START_AUDIO_SCENE(func_5(iVar0)); } } iLocal_114 = iVar0; if (bVar1) { if (Local_71.f_211 == -1) { Local_71.f_211 = AUDIO::GET_SOUND_ID(); if (Local_71.f_211 != -1) { AUDIO::PLAY_SOUND_FRONTEND(Local_71.f_211, func_4(iLocal_115, 1), func_3(iLocal_115), true); } } } else if (Local_71.f_211 != -1) { AUDIO::STOP_SOUND(Local_71.f_211); AUDIO::RELEASE_SOUND_ID(Local_71.f_211); Local_71.f_211 = -1; } } char* func_3(int iParam0) { switch (iParam0) { case 1: return "DLC_GR_MOC_Turret_Sounds"; case 2: return "dlc_xm_avngr_turret_Sounds"; case 3: return "DLC_XM17_IAA_Finale_Remote_Turrets_Sounds"; case 4: return ""; default: } return "INVALID_TURRET_FIRE_SOUNDS"; } char* func_4(int iParam0, int iParam1) { switch (iParam1) { case 1: if (func_124(3)) { return "Background_Loop"; } return "Turret_Camera_Hum_Loop"; break; case 2: switch (iParam0) { case 4: return "SPL_ROCKET_HELI_NPC_master"; default: } if (func_124(3)) { return "Fire_Missile_Oneshot"; } return "Fire"; break; case 3: if (func_124(3)) { return "Fire_MG_Loop"; } return "Fire"; break; } return "INVALID_TURRET_FIRE_KEY"; } char* func_5(int iParam0) { switch (iParam0) { case 1: return "DLC_GR_MOC_Turret_View_Scene"; case 2: return "MCU_FirstPerson_Seated_Scene"; case 3: return "dlc_xm_avenger_turret_scene"; case 4: return "dlc_xm_avenger_first_person_seated_scene"; case 5: return "dlc_xm17_IAA_Turret_Scene"; default: } return "INVALID_INTERIOR_AUDIO_SCENE"; } int func_6() { if (CAM::_0xEE778F8C7E1142E2(CAM::_0x19CAFA3C87F7C2FF()) == 4) { return 1; } return 0; } int func_7(struct<3> Param0) { if ((Param0.x == 0f && Param0.f_1 == 0f) && Param0.f_2 == 0f) { return 1; } return 0; } Vector3 func_8(int iParam0) { return ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED(iParam0), false); } char* func_9(int iParam0) { bool bVar0; bool bVar1; int iVar2; int iVar3; int iVar4; int iVar5; if (Global_1319110 != -1) { if (func_43(Global_1590374) && !MISC::IS_BIT_SET(Global_4456448.f_25, 7)) { return "HUNTGUN_T_3"; } else { return "HUNTGUN_T_2b"; } } if (func_124(3)) { iVar2 = func_26(1); if (iVar2 != Global_1319116) { bVar0 = func_25(iVar2); if (bVar0) { switch (iVar2) { case 1: if (!func_25(1)) { bVar0 = false; } break; case 2: if (!func_25(2)) { bVar0 = false; } break; case 3: if (!func_25(3)) { bVar0 = false; } break; case 4: if (!func_25(4)) { bVar0 = false; } break; } } } else { bVar0 = false; } iVar3 = func_26(0); if (iVar3 != Global_1319116) { bVar1 = func_25(iVar3); if (bVar1) { switch (iVar3) { case 1: if (!func_25(1)) { bVar1 = false; } break; case 2: if (!func_25(2)) { bVar1 = false; } break; case 3: if (!func_25(3)) { bVar1 = false; } break; case 4: if (!func_25(4)) { bVar1 = false; } break; } } else { bVar1 = false; } } else { bVar1 = false; } switch (Global_1319116) { case 1: if (bVar0 && bVar1) { return "IAA_T_2_OSM1"; } else if (bVar1) { return "IAA_T_2_OSL1"; } else if (bVar0) { return "IAA_T_2_OSR1"; } else { return "IAA_T_2_OSN1"; } break; case 2: if (bVar0 && bVar1) { return "IAA_T_2_OSM2"; } else if (bVar1) { return "IAA_T_2_OSL2"; } else if (bVar0) { return "IAA_T_2_OSR2"; } else { return "IAA_T_2_OSN2"; } break; case 3: if (bVar0 && bVar1) { return "IAA_T_2_OSM3"; } else if (bVar1) { return "IAA_T_2_OSL3"; } else if (bVar0) { return "IAA_T_2_OSR3"; } else { return "IAA_T_2_OSN3"; } break; case 4: if (bVar0 && bVar1) { return "IAA_T_2_OSM4"; } else if (bVar1) { return "IAA_T_2_OSL4"; } else if (bVar0) { return "IAA_T_2_OSR4"; } else { return "IAA_T_2_OSN4"; } break; } } bVar1 = false; bVar0 = false; if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { iVar4 = func_22(1); if (iVar4 != Global_1319116) { bVar0 = func_21(iVar4); if (bVar0) { switch (iVar4) { case 1: if (!func_19()) { bVar0 = false; } break; case 2: if (!func_18()) { bVar0 = false; } break; case 3: if (!func_10()) { bVar0 = false; } break; } } } else { bVar0 = false; } iVar5 = func_22(0); if (iVar5 != Global_1319116) { bVar1 = func_21(iVar5); if (bVar1) { switch (func_22(0)) { case 1: if (!func_19()) { bVar1 = false; } break; case 2: if (!func_18()) { bVar1 = false; } break; case 3: if (!func_10()) { bVar1 = false; } break; } } else { bVar1 = false; } } else { bVar1 = false; } switch (Global_1319116) { case 1: if (bVar0 && bVar1) { return "HUNTGUN_T_2_OSM1"; } else if (bVar1) { return "HUNTGUN_T_2_OSL1"; } else if (bVar0) { return "HUNTGUN_T_2_OSR1"; } else { return "HUNTGUN_T_2_OSN1"; } break; case 2: if (bVar0 && bVar1) { return "HUNTGUN_T_2_OSM3"; } else if (bVar1) { return "HUNTGUN_T_2_OSL3"; } else if (bVar0) { return "HUNTGUN_T_2_OSR3"; } else { return "HUNTGUN_T_2_OSN3"; } break; case 3: if (bVar0 && bVar1) { return "HUNTGUN_T_2_OSM2"; } else if (bVar1) { return "HUNTGUN_T_2_OSL2"; } else if (bVar0) { return "HUNTGUN_T_2_OSR2"; } else { return "HUNTGUN_T_2_OSN2"; } break; } } if (ENTITY::DOES_ENTITY_EXIST(iParam0)) { switch (ENTITY::GET_ENTITY_MODEL(iParam0)) { case joaat("bombushka"): return "BOMBGUN_T_2c"; break; case joaat("rhino"): return "BOMBGUN_T_2c"; break; case joaat("akula"): return "AKULAGUN_P2"; break; } } return ""; } int func_10() { int iVar0; if (func_141(PLAYER::PLAYER_ID())) { iVar0 = func_16(0, 0); } else if (func_140(PLAYER::PLAYER_ID())) { iVar0 = Global_2537071.f_307; } if (ENTITY::DOES_ENTITY_EXIST(iVar0)) { if (!ENTITY::IS_ENTITY_DEAD(iVar0, false)) { if (func_141(PLAYER::PLAYER_ID())) { if (VEHICLE::GET_VEHICLE_MOD(iVar0, 10) == 1 && !func_11()) { return 1; } } if (func_140(PLAYER::PLAYER_ID())) { if (VEHICLE::GET_VEHICLE_MOD(iVar0, 10) == 1) { return 1; } } } } return 0; } int func_11() { int iVar0; struct<3> Var1; if (func_15(PLAYER::PLAYER_ID(), 1, 1)) { if (Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_261.f_22 != 0) { iVar0 = func_14(PLAYER::PLAYER_ID()); if (func_13(iVar0)) { Var1 = { func_12(iVar0) }; if (ENTITY::DOES_ENTITY_EXIST(func_16(0, 0))) { if (!ENTITY::IS_ENTITY_DEAD(func_16(0, 0), false)) { if (MISC::GET_DISTANCE_BETWEEN_COORDS(ENTITY::GET_ENTITY_COORDS(func_16(0, 0), true), Var1, true) < 150f) { return 1; } } } } } } return 0; } Vector3 func_12(int iParam0) { return Global_4008564[iParam0 /*45*/].f_4; } int func_13(int iParam0) { if (iParam0 > -1 && iParam0 < 37) { return 1; } return 0; } var func_14(int iParam0) { return Global_2420771[iParam0 /*3*/]; } int func_15(int iParam0, bool bParam1, bool bParam2) { int iVar0; iVar0 = iParam0; if (iVar0 != -1) { if (NETWORK::NETWORK_IS_PLAYER_ACTIVE(iParam0)) { if (bParam1) { if (!PLAYER::IS_PLAYER_PLAYING(iParam0)) { return 0; } } if (bParam2) { if (!Global_2439138.f_3[iVar0]) { return 0; } } return 1; } } return 0; } int func_16(int iParam0, bool bParam1) { if (func_141(PLAYER::PLAYER_ID()) || iParam0) { if (Global_1590379 != func_17()) { if (!ENTITY::DOES_ENTITY_EXIST(Global_1694019[Global_1590379])) { return Global_1370251; } return Global_1694019[Global_1590379]; } } if (bParam1) { if (Global_1590380 != func_17()) { return Global_1694019[Global_1590380]; } } return -1; } int func_17() { return -1; } int func_18() { int iVar0; if (func_141(PLAYER::PLAYER_ID())) { iVar0 = func_16(0, 0); } else if (func_140(PLAYER::PLAYER_ID())) { iVar0 = Global_2537071.f_307; } if (ENTITY::DOES_ENTITY_EXIST(iVar0)) { if (!ENTITY::IS_ENTITY_DEAD(iVar0, false)) { if (func_141(PLAYER::PLAYER_ID())) { if (VEHICLE::GET_VEHICLE_MOD(iVar0, 10) == 1 && !func_11()) { return 1; } } if (func_140(PLAYER::PLAYER_ID())) { if (VEHICLE::GET_VEHICLE_MOD(iVar0, 10) == 1) { return 1; } } } } return 0; } int func_19() { if (func_141(PLAYER::PLAYER_ID())) { if (ENTITY::DOES_ENTITY_EXIST(func_16(0, 0))) { if (!ENTITY::IS_ENTITY_DEAD(func_16(0, 0), false)) { if (func_20(Global_1590379) && !func_11()) { return 1; } if ((VEHICLE::GET_VEHICLE_MOD(func_16(0, 0), 10) == 0 || VEHICLE::GET_VEHICLE_MOD(func_16(0, 0), 10) == 1) && !func_11()) { return 1; } } } } if (func_140(PLAYER::PLAYER_ID())) { if (ENTITY::DOES_ENTITY_EXIST(Global_2537071.f_307)) { if (!ENTITY::IS_ENTITY_DEAD(Global_2537071.f_307, false)) { if (VEHICLE::GET_VEHICLE_MOD(Global_2537071.f_307, 10) == 0 || VEHICLE::GET_VEHICLE_MOD(Global_2537071.f_307, 10) == 1) { return 1; } } } } return 0; } int func_20(int iParam0) { if (iParam0 != func_17()) { return MISC::IS_BIT_SET(Global_1590535[iParam0 /*876*/].f_274.f_278, 0); } return 0; } int func_21(int iParam0) { int iVar0; int iVar1; int iVar2; if (iParam0 == -1) { return 0; } iVar0 = Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_310.f_6; iVar1 = 0; while (iVar1 < 32) { iVar2 = PLAYER::INT_TO_PLAYERINDEX(iVar1); if (func_15(iVar2, 1, 1) && iVar2 != PLAYER::PLAYER_ID()) { if (Global_2425662[iVar2 /*421*/].f_310.f_6 == iVar0) { if (Global_1590535[iVar2 /*876*/].f_846 == iParam0) { return 0; } } } iVar1++; } return 1; } int func_22(int iParam0) { int iVar0; if (func_141(PLAYER::PLAYER_ID())) { if (ENTITY::IS_ENTITY_DEAD(Global_1370251, false)) { return -1; } } else if (func_140(PLAYER::PLAYER_ID())) { if (ENTITY::IS_ENTITY_DEAD(Global_2537071.f_307, false)) { return -1; } } if (iParam0 == 0) { iVar0 = (Global_1319116 % 3) + 1; while (!func_24(iVar0)) { iVar0 = (iVar0 % 3) + 1; } return iVar0; } iVar0 = func_23(Global_1319116 == 1, 3, (Global_1319116 - 1)); while (!func_24(iVar0)) { iVar0 = func_23(iVar0 <= 1, 3, (iVar0 - 1)); } return iVar0; } int func_23(bool bParam0, int iParam1, int iParam2) { if (bParam0) { return iParam1; } return iParam2; } int func_24(int iParam0) { switch (iParam0) { case 1: if (func_19() && func_21(iParam0)) { return 1; } break; case 2: if (func_18() && func_21(iParam0)) { return 1; } break; case 3: if (func_10() && func_21(iParam0)) { return 1; } break; default: return 1; break; } return 0; } int func_25(int iParam0) { int iVar0; int iVar1; int iVar2; if (iParam0 == -1) { return 0; } iVar0 = Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_310.f_6; iVar1 = 0; while (iVar1 < 32) { iVar2 = PLAYER::INT_TO_PLAYERINDEX(iVar1); if (func_15(iVar2, 1, 1) && iVar2 != PLAYER::PLAYER_ID()) { if (Global_2425662[iVar2 /*421*/].f_310.f_6 == iVar0) { if (Global_1590535[iVar2 /*876*/].f_846 == iParam0) { return 0; } } } iVar1++; } return 1; } int func_26(int iParam0) { int iVar0; if (ENTITY::IS_ENTITY_DEAD(iLocal_120, false)) { return -1; } if (iParam0 == 0) { iVar0 = (Global_1319116 % 4) + 1; while (!func_25(iVar0)) { iVar0 = (iVar0 % 4) + 1; } return iVar0; } iVar0 = func_23(Global_1319116 == 1, 4, (Global_1319116 - 1)); while (!func_25(iVar0)) { iVar0 = func_23(iVar0 <= 1, 4, (iVar0 - 1)); } return iVar0; } int func_27() { int iVar0; if (func_193(PLAYER::PLAYER_ID())) { iVar0 = func_40(PLAYER::PLAYER_ID()); if (func_15(iVar0, 0, 1)) { if ((((((func_39(iVar0) && func_37(func_38(iVar0)) == 4) && ENTITY::DOES_ENTITY_EXIST(PLAYER::GET_PLAYER_PED(iVar0))) && !PED::IS_PED_INJURED(PLAYER::GET_PLAYER_PED(iVar0))) && PED::IS_PED_IN_ANY_VEHICLE(PLAYER::GET_PLAYER_PED(iVar0), false)) && ENTITY::DOES_ENTITY_EXIST(PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED(iVar0), false))) && func_36(PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED(iVar0), false))) { return 1; } if (!func_35(Global_4456448.f_194990)) { if (func_193(iVar0)) { if (func_43(iVar0)) { return 1; } else if (func_39(PLAYER::PLAYER_ID()) || func_34()) { return 1; } } } } } if (Global_1687716) { return 1; } if (func_141(PLAYER::PLAYER_ID())) { iVar0 = func_33(PLAYER::PLAYER_ID()); if (func_15(iVar0, 0, 1)) { if ((((((func_39(iVar0) && func_37(func_38(iVar0)) == 9) && ENTITY::DOES_ENTITY_EXIST(PLAYER::GET_PLAYER_PED(iVar0))) && !PED::IS_PED_INJURED(PLAYER::GET_PLAYER_PED(iVar0))) && PED::IS_PED_IN_ANY_VEHICLE(PLAYER::GET_PLAYER_PED(iVar0), false)) && ENTITY::DOES_ENTITY_EXIST(PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED(iVar0), false))) && ENTITY::GET_ENTITY_MODEL(PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED(iVar0), false)) == joaat("avenger")) { return 1; } if (func_32(iVar0)) { return 1; } else if (func_39(PLAYER::PLAYER_ID()) || func_34()) { return 1; } } } if (func_31(PLAYER::PLAYER_ID(), 0)) { iVar0 = func_30(PLAYER::PLAYER_ID()); if (func_15(iVar0, 0, 1)) { if ((((Global_1590382 != func_17() && func_39(Global_1590382)) && func_37(func_38(Global_1590382)) == 11) && func_29(Global_1590382, -1)) && VEHICLE::IS_VEHICLE_MODEL(PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED(Global_1590382), false), joaat("terbyte"))) { return 1; } else if (func_28(iVar0)) { return 1; } else if (func_39(PLAYER::PLAYER_ID()) || func_34()) { return 1; } } } if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { switch (Global_1319116) { case 1: if (Global_262145.f_22584) { return 1; } break; case 2: if (Global_262145.f_22585) { return 1; } break; case 3: if (Global_262145.f_22586) { return 1; } break; } } if (Global_1319114 == 1) { return 1; } if (func_124(3)) { if (Global_1573352 == 185) { if (Global_1574442 != 0) { return 1; } } } return 0; } int func_28(int iParam0) { if (iParam0 != func_17()) { return MISC::IS_BIT_SET(Global_2425662[iParam0 /*421*/].f_310.f_3, 4); } return 0; } int func_29(int iParam0, int iParam1) { int iVar0; if (func_15(iParam0, 1, 1)) { if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::GET_PLAYER_PED(iParam0), false)) { iVar0 = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED(iParam0), false); if (VEHICLE::IS_VEHICLE_DRIVEABLE(iVar0, false)) { if (PLAYER::PLAYER_PED_ID() == VEHICLE::GET_PED_IN_VEHICLE_SEAT(iVar0, iParam1, 0)) { return 1; } } } } return 0; } int func_30(int iParam0) { if (iParam0 == func_17()) { return iParam0; } return Global_2425662[iParam0 /*421*/].f_310.f_8; } int func_31(int iParam0, bool bParam1) { int iVar0; if (bParam1) { if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), false)) { iVar0 = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false); if (ENTITY::GET_ENTITY_MODEL(iVar0) == joaat("terbyte")) { return 1; } } } if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { if (Global_2425662[iParam0 /*421*/].f_310.f_5 != -1 && Global_2425662[iParam0 /*421*/].f_310.f_8 != func_17()) { return func_37(Global_2425662[iParam0 /*421*/].f_310.f_5) == 12; } } } return 0; } int func_32(int iParam0) { if (iParam0 != func_17()) { return MISC::IS_BIT_SET(Global_2425662[iParam0 /*421*/].f_310.f_2, 6); } return 0; } int func_33(int iParam0) { if (iParam0 == func_17()) { return iParam0; } return Global_2425662[iParam0 /*421*/].f_310.f_8; } bool func_34() { return MISC::IS_BIT_SET(Global_1676377, 6); } bool func_35(int iParam0) { return Global_262145.f_4999[4] == iParam0; } int func_36(int iParam0) { if (ENTITY::GET_ENTITY_MODEL(iParam0) == joaat("hauler2") || ENTITY::GET_ENTITY_MODEL(iParam0) == joaat("phantom3")) { return 1; } return 0; } int func_37(int iParam0) { switch (iParam0) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: return 0; break; case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69: return 1; break; case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: case 38: case 39: case 40: case 41: return 2; break; case 43: case 42: case 44: case 45: case 46: case 47: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: case 98: case 99: case 100: case 112: case 113: case 114: case 115: case 119: case 116: case 118: case 120: case 121: case 126: case 127: case 134: case 135: case 136: case 137: case 138: case 139: case 140: case 141: case 142: case 143: case 144: return 3; break; case 70: case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case joaat("MPSV_LP0_31"): case 80: return 4; break; case 81: return 5; break; case 82: return 6; break; case 83: case 84: case 85: case 86: case 87: return 7; break; case 88: return 8; break; case 89: case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: return 9; break; case 101: return 10; break; case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: case 110: case 111: return 11; break; case 117: return 12; break; case 122: return 13; break; case 123: return 14; break; case 124: return 15; break; case 125: return 16; break; case 128: case 129: case 130: case 131: case 132: case 133: return 17; break; case 145: return 18; break; } return -1; } int func_38(int iParam0) { if (iParam0 != func_17() && func_15(iParam0, 1, 1)) { return Global_2425662[iParam0 /*421*/].f_310.f_14; } return -1; } int func_39(int iParam0) { if (iParam0 != func_17() && func_15(iParam0, 1, 1)) { return MISC::IS_BIT_SET(Global_2425662[iParam0 /*421*/].f_310, 3); } return 0; } int func_40(int iParam0) { if (iParam0 == func_17()) { return iParam0; } return Global_2425662[iParam0 /*421*/].f_310.f_8; } bool func_41(char* sParam0) { HUD::BEGIN_TEXT_COMMAND_IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(sParam0); return HUD::END_TEXT_COMMAND_IS_THIS_HELP_MESSAGE_BEING_DISPLAYED(0); } int func_42(int iParam0, int iParam1) { if (ENTITY::DOES_ENTITY_EXIST(iParam0)) { if (!ENTITY::IS_ENTITY_DEAD(iParam0, false) || iParam1) { if (ENTITY::IS_ENTITY_IN_WATER(iParam0)) { if (ENTITY::GET_ENTITY_SUBMERGED_LEVEL(iParam0) >= 0.7f) { return 1; } } } } return 0; } int func_43(int iParam0) { if (iParam0 != func_17()) { return MISC::IS_BIT_SET(Global_2425662[iParam0 /*421*/].f_310, 6); } return 0; } int func_44(int iParam0) { if (iParam0 == 1) { if (Global_19486.f_1 > 3) { if (MISC::IS_BIT_SET(Global_7356, 14)) { return 1; } else { return 0; } } else { return 0; } } if (SCRIPT::_GET_NUMBER_OF_REFERENCES_OF_SCRIPT_WITH_NAME_HASH(joaat("cellphone_flashhand")) > 0) { return 1; } if (Global_19486.f_1 > 3) { return 1; } return 0; } bool func_45() { return MISC::GET_GAME_TIMER() <= Global_22350.f_5878 + 100; } void func_46() { int iVar0; int iVar1; int iVar2; struct<3> Var3; struct<3> Var4; float fVar5; float fVar6; int iVar7; float fVar8; float fVar9; var uVar10; var uVar11; bool bVar12; bool bVar13; if (func_56()) { return; } fVar6 = 99999f; iVar7 = -1; iVar0 = 0; while (iVar0 < 32) { bVar12 = MISC::IS_BIT_SET(Global_1574316, iVar0); iVar2 = iVar0; if (iVar2 != PLAYER::PLAYER_ID()) { if (func_15(iVar2, 1, 1)) { iVar1 = PLAYER::GET_PLAYER_PED(iVar2); Var3 = { ENTITY::GET_ENTITY_COORDS(iVar1, true) }; if (MISC::GET_DISTANCE_BETWEEN_COORDS(ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true), Var3, true) <= 150f) { if (func_55(iVar2, -1)) { if (GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var3, &fVar8, &fVar9)) { if (!bVar12) { if (func_54(fVar8, fVar9, 0.4f, 0.4f, 0.6f, 0.6f)) { fVar5 = func_53(fVar8, fVar9, &uVar10, &uVar11); if (fVar5 < fVar6) { fVar6 = fVar5; iVar7 = iVar0; Var4 = { Var3 }; } } } } } } } } iVar0++; } if (iVar7 != -1) { if (GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var4 + Vector(-1f, 0f, 0f), &fVar8, &fVar9)) { func_47(fVar8, fVar9); if (!HUD::IS_PAUSE_MENU_ACTIVE()) { bVar13 = false; if (PAD::_IS_USING_KEYBOARD(0)) { bVar13 = PAD::IS_CONTROL_JUST_PRESSED(0, 25); } else { bVar13 = PAD::IS_CONTROL_JUST_PRESSED(2, 201); } if (bVar13) { MISC::SET_BIT(&Global_1574316, iVar7); } } } } } void func_47(float fParam0, float fParam1) { var uVar0; var uVar1; if (func_56()) { return; } func_49(&uVar0, &uVar1, fParam0, fParam1); if (PAD::_IS_USING_KEYBOARD(0)) { func_48("HUNTGUN_5_KM", -1); } else { func_48("HUNTGUN_5", -1); } } void func_48(char* sParam0, int iParam1) { HUD::BEGIN_TEXT_COMMAND_DISPLAY_HELP(sParam0); HUD::END_TEXT_COMMAND_DISPLAY_HELP(0, false, true, iParam1); } void func_49(var uParam0, var uParam1, var uParam2, var uParam3) { *uParam0 = uParam2; uParam0->f_1 = uParam3; *uParam1 = 0; uParam1->f_1 = 0.25f; uParam1->f_2 = 0.25f; uParam1->f_7 = 2; func_50(func_51(1), &(uParam1->f_3), &(uParam1->f_4), &(uParam1->f_5), &(uParam1->f_6)); } void func_50(int iParam0, var uParam1, var uParam2, var uParam3, var uParam4) { *uParam1 = MISC::GET_BITS_IN_RANGE(iParam0, 24, 31); *uParam2 = MISC::GET_BITS_IN_RANGE(iParam0, 16, 23); *uParam3 = MISC::GET_BITS_IN_RANGE(iParam0, 8, 15); *uParam4 = MISC::GET_BITS_IN_RANGE(iParam0, 0, 7); } int func_51(int iParam0) { int iVar0; int iVar1; int iVar2; int iVar3; HUD::GET_HUD_COLOUR(iParam0, &iVar0, &iVar1, &iVar2, &iVar3); return func_52(iVar0, iVar1, iVar2, iVar3); } var func_52(int iParam0, int iParam1, int iParam2, int iParam3) { var uVar0; MISC::SET_BITS_IN_RANGE(&uVar0, 24, 31, iParam0); MISC::SET_BITS_IN_RANGE(&uVar0, 16, 23, iParam1); MISC::SET_BITS_IN_RANGE(&uVar0, 8, 15, iParam2); MISC::SET_BITS_IN_RANGE(&uVar0, 0, 7, iParam3); return uVar0; } float func_53(float fParam0, float fParam1, var uParam2, var uParam3) { float fVar0; float fVar1; if (fParam0 <= 0.5f) { fVar0 = (0.5f - fParam0); } else { fVar0 = (fParam0 - 0.5f); } if (fParam1 <= 0.5f) { fVar1 = (0.5f - fParam1); } else { fVar1 = (fParam1 - 0.5f); } *uParam2 = fVar0; *uParam3 = fVar1; return (fVar0 + fVar1); } int func_54(float fParam0, float fParam1, float fParam2, float fParam3, float fParam4, float fParam5) { if (fParam0 >= fParam2 && fParam0 <= fParam4) { if (fParam1 >= fParam3 && fParam1 <= fParam5) { return 1; } } return 0; } int func_55(int iParam0, int iParam1) { if (iParam1 == -1) { return MISC::IS_BIT_SET(Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_33, iParam0); } else if (Global_2439138.f_3781[iParam0] >= iParam1) { return 1; } return 0; } int func_56() { if (MISC::IS_BIT_SET(Global_4456448.f_33, 24)) { return 1; } if (MISC::IS_BIT_SET(Global_4456448.f_33, 25)) { return 1; } return 0; } void func_57() { int iVar0; int iVar1; int iVar2; int iVar3; struct<3> Var4; struct<3> Var5; struct<3> Var6; struct<3> Var7; struct<3> Var8; int iVar9; int iVar10; int iVar11; struct<3> Var12; struct<3> Var13; struct<2> Var14; struct<2> Var15; struct<2> Var16; struct<2> Var17; struct<2> Var18; if (func_113(iLocal_120) || (func_112() && !HUD::IS_PAUSE_MENU_ACTIVE())) { if (!func_69()) { if (func_124(3)) { iVar0 = joaat("w_ex_vehiclemissile_3"); } else if (((func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) || func_141(PLAYER::PLAYER_ID())) || func_140(PLAYER::PLAYER_ID())) { iVar0 = joaat("w_lr_rpg_rocket"); } else { iVar0 = WEAPON::GET_WEAPONTYPE_MODEL(func_68(iLocal_120)); } STREAMING::REQUEST_MODEL(iVar0); if (STREAMING::HAS_MODEL_LOADED(iVar0)) { if (((PAD::IS_DISABLED_CONTROL_PRESSED(2, 229) || PAD::IS_CONTROL_PRESSED(2, 229)) && !bLocal_81) && !func_122(&(Global_2439138.f_4000))) { if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID())) { if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { if (CAM::DOES_CAM_EXIST(Local_71.f_32)) { if (CAM::IS_CAM_ACTIVE(Local_71.f_32)) { iVar1 = 250; if (func_65(PLAYER::PLAYER_ID(), 0)) { iVar2 = -1; if (DECORATOR::DECOR_IS_REGISTERED_AS_TYPE("MC_EntityID", 3)) { if (DECORATOR::DECOR_EXIST_ON(iLocal_120, "MC_EntityID")) { iVar2 = DECORATOR::DECOR_GET_INT(iLocal_120, "MC_EntityID"); } } if (iVar2 != -1 && Global_4456448.f_124065[iVar2 /*325*/].f_219 != -1) { iVar1 = Global_4456448.f_124065[iVar2 /*325*/].f_219; } } iVar3 = iLocal_120; if (func_64(iLocal_120, Global_1319115) || func_112()) { if (func_62()) { if (!ENTITY::IS_ENTITY_DEAD(Local_71.f_9, false)) { iVar3 = ENTITY::GET_VEHICLE_INDEX_FROM_ENTITY_INDEX(Local_71.f_9); } Var4 = { func_59() }; if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { Var4 = { CAM::GET_FINAL_RENDERED_CAM_COORD() }; Var5 = { CAM::GET_FINAL_RENDERED_CAM_ROT(2) }; Var6 = { (-SYSTEM::SIN(Var5.f_2) * SYSTEM::COS(Var5.x)), (SYSTEM::COS(Var5.f_2) * SYSTEM::COS(Var5.x)), SYSTEM::SIN(Var5.x) }; Var7 = { 10f, 10f, 10f }; Var8 = { Var4 + Var6 * Var7 }; MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS_IGNORE_ENTITY_NEW(Var4, Var8, iVar1, true, func_68(iLocal_120), PLAYER::PLAYER_PED_ID(), true, true, -1f, iVar3, false, false, false, true, 0, 1); } else { MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS_IGNORE_ENTITY_NEW(Var4, Local_71.f_45, iVar1, true, func_68(iLocal_120), PLAYER::PLAYER_PED_ID(), true, true, -1f, iVar3, false, false, false, true, 0, 1); } func_144(&(Global_2439138.f_4000), 0, 0); if (iLocal_115 != 0) { AUDIO::PLAY_SOUND_FROM_ENTITY(-1, func_4(iLocal_115, 2), iLocal_120, func_3(iLocal_115), true, func_58(iLocal_115, 2)); if (iLocal_115 == 4) { AUDIO::PLAY_SOUND_FRONTEND(-1, func_4(iLocal_115, 2), 0, true); } } } } else if (!func_64(iLocal_120, Global_1319115)) { } } } } } } } if (func_124(3)) { if (STREAMING::HAS_MODEL_LOADED(iVar0)) { if ((PAD::IS_DISABLED_CONTROL_PRESSED(2, 228) || PAD::IS_CONTROL_PRESSED(2, 228)) && !func_122(&Local_74)) { if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID())) { if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { if (CAM::DOES_CAM_EXIST(Local_71.f_32)) { if (CAM::IS_CAM_ACTIVE(Local_71.f_32)) { iVar9 = 250; if (func_65(PLAYER::PLAYER_ID(), 0)) { iVar10 = -1; if (DECORATOR::DECOR_IS_REGISTERED_AS_TYPE("MC_EntityID", 3)) { if (DECORATOR::DECOR_EXIST_ON(iLocal_120, "MC_EntityID")) { iVar10 = DECORATOR::DECOR_GET_INT(iLocal_120, "MC_EntityID"); } } if (iVar10 != -1 && Global_4456448.f_124065[iVar10 /*325*/].f_219 != -1) { iVar9 = Global_4456448.f_124065[iVar10 /*325*/].f_219; } } iVar11 = iLocal_120; if (func_64(iLocal_120, Global_1319115) || func_112()) { if (!ENTITY::IS_ENTITY_DEAD(Local_71.f_9, false)) { iVar11 = ENTITY::GET_VEHICLE_INDEX_FROM_ENTITY_INDEX(Local_71.f_9); } Var12 = { func_59() }; if (func_124(3)) { Var13 = { CAM::GET_CAM_ROT(CAM::GET_RENDERING_CAM(), 2) }; Var12 = { OBJECT::_GET_OBJECT_OFFSET_FROM_COORDS(Var12, Var13.f_2, -0.5f, 0f, 0f) }; } MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS_IGNORE_ENTITY_NEW(Var12, Local_71.f_45, iVar9, true, joaat("vehicle_weapon_player_bullet"), PLAYER::PLAYER_PED_ID(), true, true, -1f, iVar11, false, false, false, true, 0, 1); func_144(&Local_74, 0, 0); if (iLocal_115 != 0) { AUDIO::PLAY_SOUND_FROM_ENTITY(-1, func_4(iLocal_115, 3), iLocal_120, func_3(iLocal_115), true, 120); } } else if (!func_64(iLocal_120, Global_1319115)) { } } } } } } else if (!(((PAD::IS_DISABLED_CONTROL_PRESSED(2, 25) || PAD::IS_CONTROL_PRESSED(2, 25)) && func_124(3)) && !func_122(&Local_74))) { if (func_122(&Local_74)) { } } } } if (func_122(&(Global_2439138.f_4000)) || func_122(&Local_74)) { if (func_64(iLocal_120, Global_1319115) || func_112()) { if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { if (func_121(&(Global_2439138.f_4000), 1000, 0)) { func_147(&(Global_2439138.f_4000)); Global_2439138.f_4000 = { Var14 }; } } else if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { if (func_121(&(Global_2439138.f_4000), 500, 0)) { func_147(&(Global_2439138.f_4000)); Global_2439138.f_4000 = { Var15 }; } } else if (func_124(3)) { if (func_122(&(Global_2439138.f_4000))) { if (func_121(&(Global_2439138.f_4000), 500, 0)) { func_147(&(Global_2439138.f_4000)); Global_2439138.f_4000 = { Var16 }; } } if (func_122(&Local_74)) { if (func_121(&Local_74, 50, 0)) { func_147(&Local_74); Local_74 = { Var17 }; } } } else if (func_121(&(Global_2439138.f_4000), 2000, 0)) { func_147(&(Global_2439138.f_4000)); Global_2439138.f_4000 = { Var18 }; } } } } } } int func_58(int iParam0, int iParam1) { switch (iParam0) { case 4: return 250; default: } return 120; } Vector3 func_59() { int iVar0; struct<3> Var1; var uVar2; struct<3> Var3; struct<3> Var4; struct<3> Var5; struct<3> Var6; struct<3> Var7; if (func_61(iLocal_120, &uVar2)) { } switch (iLocal_78) { case joaat("buzzard"): case joaat("savage"): switch (func_60()) { case 0: Var1 = { 1.59f, 0.415f, -0.43f }; break; case 1: Var1 = { -1.59f, 0.415f, -0.43f }; break; } break; case joaat("valkyrie"): switch (func_60()) { case 0: Var1 = { 2.89f, 1.215f, -0.43f }; break; case 1: Var1 = { -2.89f, 1.215f, -0.43f }; break; } break; case joaat("hunter"): switch (func_60()) { case 0: Var1 = { 2.89f, 1.215f, -0.43f }; break; case 1: Var1 = { -2.89f, 1.215f, -0.43f }; break; } break; } if (func_191(iLocal_120)) { switch (func_78()) { case 0: Var1 = { 0.0122f, 8.7349f, 0.7239f }; break; case 1: Var1 = { 0.0082f, 1.1879f, 5.2393f }; break; case 2: Var1 = { -0.0083f, -22.7956f, 4.218f }; break; } } if (Global_1319116 != -1) { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("bombushka")) { switch (Global_1319116) { case 0: Var1 = { 0.0122f, 8.7349f, 0.7239f }; break; case 1: Var1 = { 0.0082f, 1.1879f, 5.2393f }; break; case 2: Var1 = { -0.0083f, -22.7956f, 4.218f }; break; } } if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol")) { switch (Global_1319116) { case 0: Var1 = { 0.0122f, 8.7349f, 0.7239f }; break; case 1: Var1 = { 0.0082f, 1.1879f, 5.2393f }; break; case 2: Var1 = { -0.0083f, -22.7956f, 4.218f }; break; } } } if (func_75(PLAYER::PLAYER_ID()) || func_124(3)) { Var3 = { 2065.848f, 2967.32f, 45.2947f }; Var4 = { 2049.612f, 2947.657f, 49.556f }; Var5 = { 2045.091f, 2943.258f, 49.4991f }; Var6 = { 2040.365f, 2952.754f, 49.5688f }; Var7 = { 2049.385f, 2953.971f, 49.9635f }; switch (Global_1319116) { case 1: Var1 = { Var4 - Var3 }; break; case 2: Var1 = { Var5 - Var3 }; break; case 3: Var1 = { Var6 - Var3 }; break; case 4: Var1 = { Var7 - Var3 }; break; } } if (Global_1319110 != -1) { switch (Global_1319110) { case 1: Var1 = { 0f, 9f, 0.92f }; break; case 2: Var1 = { -2.4f, -8f, 1.14f }; break; case 3: Var1 = { 2.4f, -8f, 1.14f }; break; case 4: Var1 = { Vector(1.7578f, 9.3693f, -1.3829f) + Vector(0f, 0.2053f, 1.3666f) }; break; } if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()) && ENTITY::DOES_ENTITY_EXIST(iLocal_120)) { if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { return ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iLocal_120, Var1); } } } if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID())) { if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), false)) { iVar0 = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()); return ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iVar0, Var1); } else if (func_112()) { return ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iLocal_120, Var1); } } } return 0f, 0f, 0f; } int func_60() { struct<3> Var0; struct<3> Var1; struct<3> Var2; float fVar3; float fVar4; float fVar5; Var2 = { CAM::GET_CAM_ROT(Local_71.f_32, 2) }; Var1 = { (-SYSTEM::SIN(Var2.f_2) * SYSTEM::COS(Var2.x)), (SYSTEM::COS(Var2.f_2) * SYSTEM::COS(Var2.x)), SYSTEM::SIN(Var2.x) }; Var0 = { ENTITY::GET_ENTITY_FORWARD_VECTOR(Local_71.f_8) }; fVar4 = MISC::ATAN2(Var1.f_1, Var1.x); fVar3 = MISC::ATAN2(Var0.f_1, Var0.x); if (fVar4 < -3.14f) { fVar4 = -3.14f; } if (fVar4 > 3.14f) { fVar4 = 3.14f; } if (fVar3 < -3.14f) { fVar3 = -3.14f; } if (fVar3 > 3.14f) { fVar3 = 3.14f; } fVar5 = (fVar4 - fVar3); if (fVar5 <= 0f) { return 0; } return 1; } int func_61(int iParam0, var uParam1) { switch (ENTITY::GET_ENTITY_MODEL(iParam0)) { case joaat("buzzard"): return 1; break; case joaat("buzzard2"): return 1; break; case joaat("polmav"): return 1; break; case joaat("frogger"): return 1; break; case joaat("maverick"): return 1; break; case joaat("annihilator"): return 1; break; case joaat("valkyrie"): *uParam1 = 1; return 1; break; case joaat("savage"): return 1; break; case joaat("hunter"): return 1; break; case joaat("bombushka"): return 1; break; case joaat("volatol"): return 1; break; case joaat("akula"): return 1; break; } return func_191(iParam0); return 0; } bool func_62() { float fVar0; bool bVar1; int iVar2; fVar0 = MISC::ABSF(Local_71.f_186.f_2); bVar1 = true; switch (ENTITY::GET_ENTITY_MODEL(iLocal_120)) { case joaat("avenger"): switch (Global_1319116) { case 1: if (VEHICLE::_GET_VEHICLE_FLIGHT_NOZZLE_POSITION(iLocal_120) >= 0.4f) { if ((fVar0 > 122.6f && fVar0 < 131.3f) && Local_71.f_186 > 7.87f) { bVar1 = false; } else if ((fVar0 > 140.5f && fVar0 < 159.5f) && Local_71.f_186 > func_63(6f, 15f, -159.5f, -140.5f, -fVar0)) { bVar1 = false; } } if (bVar1 && VEHICLE::_DOES_VEHICLE_HAVE_LANDING_GEAR(iLocal_120)) { iVar2 = VEHICLE::GET_LANDING_GEAR_STATE(iLocal_120); if ((iVar2 == 0 || iVar2 == 3) || iVar2 == 1) { if (Local_71.f_186 > -13f) { if (Local_71.f_186 > -3.7f) { bVar1 = !fVar0 > 157f; } else { bVar1 = !(fVar0 > 164f && fVar0 < 177f); } } } else { bVar1 = !(fVar0 > 140.5f && Local_71.f_186 > func_63(0.5f, 15f, -180f, -140.5f, -fVar0)); } } break; case 2: if (VEHICLE::_GET_VEHICLE_FLIGHT_NOZZLE_POSITION(iLocal_120) >= 0.4f) { bVar1 = !((fVar0 > 111.2f && fVar0 < 125.8f) && Local_71.f_186 < 20f); } if (bVar1) { bVar1 = !((fVar0 > 20f && fVar0 < 27.6f) && Local_71.f_186 < 10.9f); } if (bVar1) { bVar1 = !((fVar0 < 28f && Local_71.f_186 < -8.5f) && Local_71.f_186 > -12f); } if (bVar1) { bVar1 = !((fVar0 < 28f && Local_71.f_186 < -8.5f) && Local_71.f_186 > -12f); } if (bVar1) { if (fVar0 < func_63(10.6f, 15.6f, 13.23f, 20f, -Local_71.f_186) && Local_71.f_186 < -13.23f) { bVar1 = false; } else if ((fVar0 > 108f && Local_71.f_186 >= -func_63(3.8f, 38f, 108f, 180f, fVar0)) && Local_71.f_186 < -func_63(1.3f, 7f, 125f, 180f, fVar0)) { bVar1 = false; } } break; case 3: if (VEHICLE::_GET_VEHICLE_FLIGHT_NOZZLE_POSITION(iLocal_120) >= 0.4f) { bVar1 = !((fVar0 > 141.3f && fVar0 < 147.7f) && Local_71.f_186 > -3.7f); } if (bVar1) { bVar1 = !(Local_71.f_186 > -18f && fVar0 > func_63(148f, 170f, -4.5f, 17.5f, -Local_71.f_186)); } if (bVar1) { bVar1 = !((fVar0 > 59.4f && fVar0 < 106f) && Local_71.f_186 > func_63(5.5f, 11.8f, -106f, -59.4f, -fVar0)); } break; } break; } return bVar1; } float func_63(float fParam0, float fParam1, float fParam2, float fParam3, float fParam4) { fParam4 = ((fParam4 - fParam2) / (fParam3 - fParam2)); return func_76(fParam0, fParam1, fParam4); } int func_64(int iParam0, int iParam1) { switch (ENTITY::GET_ENTITY_MODEL(iParam0)) { case joaat("buzzard"): return 1; break; case joaat("savage"): return 1; break; } if (iParam1 != -1) { if (func_191(iParam0)) { } } return 0; } int func_65(int iParam0, int iParam1) { int iVar0; if (func_67() != 0) { return 0; } if (!func_66(iParam0)) { return 0; } iVar0 = iParam0; if (Global_1590535[iVar0 /*876*/] == iParam1) { return 1; } return 0; } int func_66(int iParam0) { if (iParam0 == -1) { return 0; } else { return MISC::IS_BIT_SET(Global_2439138.f_1, iParam0); } return 1; } int func_67() { return Global_30768; } int func_68(int iParam0) { int iVar0; iVar0 = ENTITY::GET_ENTITY_MODEL(ENTITY::GET_VEHICLE_INDEX_FROM_ENTITY_INDEX(iParam0)); if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { return joaat("VEHICLE_WEAPON_AVENGER_CANNON"); } switch (iVar0) { case joaat("savage"): case joaat("buzzard"): return joaat("weapon_passenger_rocket"); break; case joaat("avenger"): return joaat("VEHICLE_WEAPON_MOBILEOPS_CANNON"); break; } if (func_124(3)) { return joaat("VEHICLE_WEAPON_MOBILEOPS_CANNON"); } return joaat("VEHICLE_WEAPON_MOBILEOPS_CANNON"); } bool func_69() { return Global_1312418; } void func_70() { int iVar0; func_145(0); func_71(); func_146(); Global_1319109 = 0; func_71(); func_135(&Local_71, iVar0, 0, iLocal_120, 1); Global_2547057 = 0; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_732 = 0; if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol")) { GRAPHICS::RESET_PARTICLE_FX_OVERRIDE("muz_xm_volatol_twinmg"); } if ((Global_1319110 != -1 || func_191(iLocal_120)) || Global_1319116 != -1) { if (!func_191(iLocal_120) && NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(iLocal_120)) { VEHICLE::_0x78CEEE41F49F421F(iLocal_120, 1); } } if (Global_2461147) { if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID())) { if (!STREAMING::IS_ENTITY_FOCUS(PLAYER::PLAYER_PED_ID())) { STREAMING::CLEAR_FOCUS(); } } } AUDIO::STOP_AUDIO_SCENE("CAR_2_HELI_FILTERING"); if (iLocal_119 != 99 && iLocal_119 > 0) { AUDIO::STOP_AUDIO_SCENE("MP_HELI_CAM_FILTERING"); iLocal_119 = 0; } } void func_71() { if (func_41("HUNTGUN_2")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_2b")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_2c")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_4")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_4b")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_4c")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_5")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_6")) { HUD::CLEAR_HELP(true); } if (func_41("AKULAGUN_P1")) { HUD::CLEAR_HELP(true); } if (func_41("AKULAGUN_P2")) { HUD::CLEAR_HELP(true); } if (MISC::IS_PC_VERSION()) { if (func_41("HUNTGUN_5_KM")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_6_KM")) { HUD::CLEAR_HELP(true); } } if ((((func_41("BOMBGUN_T_2b") || func_41("BOMBGUN_T_2c")) || func_41("BOMBGUN_T_2d")) || func_41("VOLGUN_T_2b")) || func_41("VOLGUN_T_2c")) { HUD::CLEAR_HELP(true); } } void func_72() { int iVar0; int iVar1; struct<3> Var2; struct<3> Var3; struct<3> Var4; struct<3> Var5; struct<3> Var6; if (!func_112()) { return; } if (!func_122(&uLocal_135)) { func_144(&uLocal_135, 0, 0); } if (!func_121(&uLocal_135, 1000, 0)) { return; } func_147(&uLocal_135); func_144(&uLocal_135, 0, 0); iVar0 = func_74(); if (iVar0 < 0 || iVar0 > 3) { return; } if (!func_7(Local_71.f_45)) { if (!MISC::IS_BIT_SET(Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_382, iVar0)) { MISC::SET_BIT(&(Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_382), iVar0); } if (Local_71.f_45 > 9999f) { Local_71.f_45 = 9999f; } if (Local_71.f_45.f_1 > 9999f) { Local_71.f_45.f_1 = 9999f; } if (Local_71.f_45.f_2 > 9999f) { Local_71.f_45.f_2 = 9999f; } if (!func_141(PLAYER::PLAYER_ID()) && !func_140(PLAYER::PLAYER_ID())) { if (!func_73(Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_383[iVar0 /*3*/], Local_71.f_45, 1056964608, 0)) { Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_383[iVar0 /*3*/] = { Local_71.f_45 }; } } else { Var2 = { CAM::GET_FINAL_RENDERED_CAM_COORD() }; Var3 = { CAM::GET_FINAL_RENDERED_CAM_ROT(2) }; Var4 = { (-SYSTEM::SIN(Var3.f_2) * SYSTEM::COS(Var3.x)), (SYSTEM::COS(Var3.f_2) * SYSTEM::COS(Var3.x)), SYSTEM::SIN(Var3.x) }; Var5 = { 10f, 10f, 10f }; Var6 = { Var2 + Var4 * Var5 }; Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_383[iVar0 /*3*/] = { Var6 }; if (!func_73(Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_383[iVar0 /*3*/], Var6, 1056964608, 0)) { Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_383[iVar0 /*3*/] = { Var6 }; } } } iVar1 = 0; while (iVar1 < 3) { if (iVar0 != iVar1) { if (MISC::IS_BIT_SET(Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_382, iVar1)) { MISC::CLEAR_BIT(&(Global_2425662[PLAYER::PLAYER_ID() /*421*/].f_382), iVar1); } } iVar1++; } } int func_73(struct<3> Param0, struct<3> Param1, float fParam2, bool bParam3) { if (fParam2 < 0f) { fParam2 = 0f; } if (!bParam3) { if (MISC::ABSF((Param0.x - Param1.x)) <= fParam2) { if (MISC::ABSF((Param0.f_1 - Param1.f_1)) <= fParam2) { if (MISC::ABSF((Param0.f_2 - Param1.f_2)) <= fParam2) { return 1; } } } } else if (MISC::ABSF((Param0.x - Param1.x)) <= fParam2) { if (MISC::ABSF((Param0.f_1 - Param1.f_1)) <= fParam2) { return 1; } } return 0; } int func_74() { if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { switch (Global_1319110) { case default: return -1; case 1: return 0; case 2: return 2; case 3: return 1; } else if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { switch (Global_1319116) { case default: return -1; case 1: return 0; case 2: return 1; case 3: return 2; } return -1; } } } int func_75(int iParam0) { if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { if (Global_2425662[iParam0 /*421*/].f_310.f_5 != -1) { return func_37(Global_2425662[iParam0 /*421*/].f_310.f_5) == 9; } } } return 0; } float func_76(float fParam0, float fParam1, float fParam2) { return (((1f - fParam2) * fParam0) + (fParam2 * fParam1)); } float func_77(float fParam0, float fParam1, float fParam2) { if (fParam0 > fParam2) { return fParam2; } else if (fParam0 < fParam1) { return fParam1; } return fParam0; } int func_78() { if (bLocal_84) { return 0; } else if (bLocal_85) { return 1; } else if (bLocal_86) { return 2; } return -1; } int func_79(int iParam0) { int iVar0; int iVar1; int iVar2; int iVar3; switch (iParam0) { case 1: return 4; case 0: return 4; case 6: return 59; case 18: return 2; case 13: return 5; case 116: return 38; case 28: return 6; case 29: return 7; case 30: return 8; case 31: return 9; case 32: return 10; case 33: return 11; case 34: return 12; case 35: return 13; case 36: return 14; case 37: return 15; case 38: return 16; case 39: return 17; case 40: return 18; case 41: return 19; case 42: return 20; case 43: return 21; case 44: return 22; case 45: return 23; case 46: return 24; case 47: return 25; case 48: return 26; case 49: return 27; case 50: return 28; case 51: return 29; case 52: return 30; case 53: return 31; case 54: return 32; case 55: return 33; case 56: return 34; case 57: return 35; case 58: return 36; case 59: return 37; case 9: return 57; case 10: return 53; case 118: return 57; case 14: return 56; case 3: return 55; case 21: return 50; case 15: return 51; case 20: return 52; case 11: return 54; case 23: return 58; case 12: return 60; case 24: return 61; case 4: return 62; default: } HUD::GET_HUD_COLOUR(iParam0, &iVar0, &iVar1, &iVar2, &iVar3); return ((((iVar0 * 16777216) + (iVar1 * 65536)) + iVar2 * 256) + iVar3); return 0; } int func_80(struct<3> Param0, bool bParam1) { int iVar0; iVar0 = HUD::ADD_BLIP_FOR_COORD(Param0); HUD::SET_BLIP_SCALE(iVar0, func_81(NETWORK::NETWORK_IS_GAME_IN_PROGRESS(), 1f, 1f)); HUD::SET_BLIP_ROUTE(iVar0, bParam1); return iVar0; } float func_81(bool bParam0, float fParam1, float fParam2) { if (bParam0) { return fParam1; } return fParam2; } Vector3 func_82(struct<3> Param0) { struct<3> Var0; Var0.x = SYSTEM::COS(Param0.x); Var0.f_1 = SYSTEM::COS(Param0.f_2); Var0.f_2 = SYSTEM::SIN(Param0.x); Var0.f_1 = (Var0.f_1 * Var0.x); Var0.x = (Var0.x * -SYSTEM::SIN(Param0.f_2)); return Var0; } void func_83(var uParam0, int iParam1, float fParam2, float fParam3, float fParam4, float fParam5, float fParam6) { if (CAM::DOES_CAM_EXIST(uParam0->f_32)) { } if (ENTITY::DOES_ENTITY_EXIST(uParam0->f_8)) { uParam0->f_9 = func_137(uParam0->f_8); } if (*uParam0 == 0) { if (func_138(uParam0, iParam1)) { *uParam0 = 1; } } else { if (iParam1 == 0) { func_105(uParam0); func_99(uParam0, fParam2, fParam3, fParam4, fParam5, fParam6); func_98(uParam0); } func_97(uParam0); func_85(uParam0, iParam1, fParam4, fParam5); func_84(); } } void func_84() { Global_96028 = 1; } void func_85(var uParam0, int iParam1, float fParam2, float fParam3) { float fVar0; float fVar1; float fVar2; float fVar3; int iVar4; int iVar5; int iVar6; int iVar7; float fVar8; float fVar9; float fVar10; float fVar11; struct<3> Var12; float fVar13; float fVar14; float fVar15; float fVar16; var uVar17; int iVar18; float fVar19; struct<3> Var20; int iVar21; struct<3> Var22; int iVar23; struct<3> Var24; struct<3> Var25; struct<3> Var26; float fVar27; struct<3> Var28; float fVar29; float fVar30; float fVar31; float fVar32; float fVar33; if (uParam0->f_50 == 1) { fVar0 = ((uParam0->f_42 - uParam0->f_31) / (uParam0->f_30 - uParam0->f_31)); if (fVar0 < 0f) { fVar0 = 0f; } if (fVar0 > 1f) { fVar0 = 1f; } fVar1 = (uParam0->f_26 + ((uParam0->f_28 - uParam0->f_26) * fVar0)); fVar2 = (uParam0->f_27 + ((uParam0->f_29 - uParam0->f_27) * fVar0)); STREAMING::_0xBED8CA5FF5E04113(1.7f, 4.7f, fVar1, fVar2); fVar3 = ENTITY::GET_ENTITY_SPEED(uParam0->f_8); if (fVar3 > 30f) { STREAMING::_0x472397322E92A856(); } STREAMING::_0x03F1A106BDA7DD3E(); if (!GRAPHICS::HAS_STREAMED_TEXTURE_DICT_LOADED("helicopterhud") || (iParam1 == 0 && !GRAPHICS::HAS_SCALEFORM_MOVIE_LOADED(iLocal_69))) { uParam0->f_86 = 0; } else { uParam0->f_80 = (1f - (2f * uParam0->f_54)); GRAPHICS::SET_SCRIPT_GFX_DRAW_ORDER(1); if (iParam1 == 0) { if (Global_1319110 != -1 && uParam0->f_213) { } else { GRAPHICS::SET_SCRIPT_GFX_DRAW_ORDER(0); GRAPHICS::DRAW_SCALEFORM_MOVIE_FULLSCREEN(iLocal_69, 255, 255, 255, 0, 1); HUD::HIDE_HUD_COMPONENT_THIS_FRAME(14); if (!uParam0->f_86) { if (VEHICLE::IS_VEHICLE_DRIVEABLE(uParam0->f_8, false)) { if (ENTITY::GET_ENTITY_MODEL(uParam0->f_8) == joaat("polmav") && VEHICLE::GET_VEHICLE_LIVERY(uParam0->f_8) == 0) { GRAPHICS::BEGIN_SCALEFORM_MOVIE_METHOD(iLocal_69, "SET_CAM_LOGO"); GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_INT(1); GRAPHICS::END_SCALEFORM_MOVIE_METHOD(); } else { GRAPHICS::BEGIN_SCALEFORM_MOVIE_METHOD(iLocal_69, "SET_CAM_LOGO"); GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_INT(0); GRAPHICS::END_SCALEFORM_MOVIE_METHOD(); } } else { GRAPHICS::BEGIN_SCALEFORM_MOVIE_METHOD(iLocal_69, "SET_CAM_LOGO"); GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_INT(0); GRAPHICS::END_SCALEFORM_MOVIE_METHOD(); } } } } uParam0->f_86 = 1; } if (uParam0->f_86 == 1) { if (iParam1 == 0) { } fVar16 = uParam0->f_157; iVar18 = -1; if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_9, false)) { Var20 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_9, true) }; } if (uParam0->f_87 == 0) { iVar4 = 0; uParam0->f_53 = 0; iVar4 = 0; while (iVar4 < uParam0->f_175) { if (MISC::IS_BIT_SET(uParam0->f_175[iVar4 /*10*/].f_2, 9)) { if (ENTITY::DOES_ENTITY_EXIST(uParam0->f_175[iVar4 /*10*/])) { if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_175[iVar4 /*10*/], false)) { if (MISC::IS_BIT_SET(uParam0->f_175[iVar4 /*10*/].f_2, 0)) { switch (uParam0->f_175[iVar4 /*10*/].f_4) { case 2: func_95(uParam0, ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[iVar4 /*10*/], 0), uParam0->f_65, uParam0->f_65.f_1, uParam0->f_65.f_2); break; case 3: func_95(uParam0, ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[iVar4 /*10*/], 0), uParam0->f_68, uParam0->f_68.f_1, uParam0->f_68.f_2); break; case 0: func_95(uParam0, ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[iVar4 /*10*/], 0), uParam0->f_62, uParam0->f_62.f_1, uParam0->f_62.f_2); break; case 1: func_95(uParam0, ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[iVar4 /*10*/], 0), uParam0->f_68, uParam0->f_68.f_1, uParam0->f_68.f_2); break; } } else if (CLOCK::GET_CLOCK_HOURS() < 19 && CLOCK::GET_CLOCK_HOURS() > 7) { func_95(uParam0, ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[iVar4 /*10*/], 0), uParam0->f_62, uParam0->f_62.f_1, uParam0->f_62.f_2); } else { func_95(uParam0, ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[iVar4 /*10*/], 0), uParam0->f_62, uParam0->f_62.f_1, uParam0->f_62.f_2); } } } } iVar4++; } if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_9, false)) { MISC::GET_GROUND_Z_FOR_3D_COORD(Var20, &uVar17, false, false); if (uParam0->f_52 == 0 && uParam0->f_48 > 0) { iVar4 = 0; while (iVar4 <= (uParam0->f_48 - 1)) { if (ENTITY::DOES_ENTITY_EXIST(uParam0->f_175[iVar4 /*10*/])) { if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_175[iVar4 /*10*/], false) && !ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { Var12 = { ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[iVar4 /*10*/], 0) }; if (ENTITY::IS_ENTITY_ON_SCREEN(uParam0->f_175[iVar4 /*10*/])) { fVar8 = 0f; fVar9 = 0f; fVar14 = MISC::GET_DISTANCE_BETWEEN_COORDS(Var12, ENTITY::GET_ENTITY_COORDS(uParam0->f_9, true), true); fVar19 = func_94(uParam0, uParam0->f_175[iVar4 /*10*/], uParam0->f_9); fVar15 = (uParam0->f_74 * fVar19); if (MISC::IS_BIT_SET(uParam0->f_175[iVar4 /*10*/].f_2, 2) || iVar4 == uParam0->f_92) { if (MISC::IS_BIT_SET(uParam0->f_175[iVar4 /*10*/].f_2, 0)) { if ((SYSTEM::TIMERA() - uParam0->f_175[iVar4 /*10*/].f_1) < 500) { func_93(uParam0, Var12, fVar19, uParam0->f_175[iVar4 /*10*/].f_4, -1, -1, -1); uParam0->f_175[iVar4 /*10*/].f_6 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_175[iVar4 /*10*/], true) }; } else { func_92(uParam0, uParam0->f_175[iVar4 /*10*/].f_4, &iVar5, &iVar6, &iVar7); GRAPHICS::SET_DRAW_ORIGIN(uParam0->f_175[iVar4 /*10*/].f_6, 0); GRAPHICS::DRAW_SPRITE("helicopterhud", "TargetLost", fVar8, fVar9, fVar15, (fVar15 * 2f), 0f, iVar5, iVar6, iVar7, 200, true); GRAPHICS::CLEAR_DRAW_ORIGIN(); func_91(iVar5, iVar6, iVar7, 0.5f, 1); uParam0->f_53 = 1; } } else { func_92(uParam0, 3, &iVar5, &iVar6, &iVar7); if (iVar4 == uParam0->f_92) { func_93(uParam0, Var12, fVar19, uParam0->f_175[iVar4 /*10*/].f_4, uParam0->f_62, uParam0->f_62.f_1, uParam0->f_62.f_2); } else { func_93(uParam0, Var12, fVar19, uParam0->f_175[iVar4 /*10*/].f_4, uParam0->f_62, uParam0->f_62.f_1, uParam0->f_62.f_2); } } if (MISC::IS_BIT_SET(uParam0->f_175[iVar4 /*10*/].f_2, 7)) { func_93(uParam0, Var12, fVar19, uParam0->f_175[iVar4 /*10*/].f_4, 227, 24, 234); } } iVar21 = 0; Var22 = { 0f, 0f, 0f }; iVar23 = 0; switch (SHAPETEST::GET_SHAPE_TEST_RESULT(uParam0->f_175[iVar4 /*10*/].f_9, &iVar21, &Var22, &Var22, &iVar23)) { case 0: Var24 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_8, true) }; Var25 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_175[iVar4 /*10*/], true) + Vector(0.5f, 0f, 0f) }; uParam0->f_175[iVar4 /*10*/].f_9 = SHAPETEST::START_SHAPE_TEST_LOS_PROBE(Var24, Var25, 1, 0, 7); break; case 2: if (iVar21 == 0) { uParam0->f_175[iVar4 /*10*/].f_1 = SYSTEM::TIMERA(); } break; } if ((SYSTEM::TIMERA() - uParam0->f_175[iVar4 /*10*/].f_1) < 1500 || MISC::IS_BIT_SET(uParam0->f_175[iVar4 /*10*/].f_2, 0)) { if ((uParam0->f_78 / (uParam0->f_40 * fVar14)) > 1f) { GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var12, &fVar8, &fVar9); fVar13 = SYSTEM::SQRT((((fVar8 - 0.5f) * (fVar8 - 0.5f)) + ((fVar9 - 0.5f) * (fVar9 - 0.5f)))); if (fVar13 < fVar16) { fVar10 = fVar8; fVar11 = fVar9; fVar10 = fVar10; fVar11 = fVar11; fVar16 = fVar13; iVar18 = iVar4; } } } GRAPHICS::CLEAR_DRAW_ORIGIN(); } } } iVar4++; } } uParam0->f_76++; if (uParam0->f_76 > (uParam0->f_48 - 1)) { uParam0->f_76 = 0; } } if (uParam0->f_92 != iVar18) { if (uParam0->f_204 != -1) { if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_204)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_204, "COP_HELI_CAM_BLEEP", 0, true); } } } uParam0->f_92 = iVar18; uParam0->f_49 = 0; if (uParam0->f_92 != -1 && uParam0->f_2 == 1) { if (!MISC::IS_BIT_SET(uParam0->f_175[uParam0->f_92 /*10*/].f_2, 0)) { if (PAD::IS_CONTROL_PRESSED(2, 229)) { if ((uParam0->f_77 / (uParam0->f_40 * fVar14)) > 0.5f) { if (uParam0->f_201 == 1) { if (uParam0->f_209 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_209)) { AUDIO::STOP_SOUND(uParam0->f_209); } } uParam0->f_201 = 0; } uParam0->f_49 = 1; if (uParam0->f_175[uParam0->f_92 /*10*/].f_3 < 1f) { if (uParam0->f_206 != -1) { if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_206)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_206, "COP_HELI_CAM_SCAN_PED_LOOP", 0, true); } } fVar16 = MISC::ABSF((1f - fVar16)); uParam0->f_175[uParam0->f_92 /*10*/].f_3 = (uParam0->f_175[uParam0->f_92 /*10*/].f_3 + ((fVar16 * SYSTEM::TIMESTEP()) / 3.5f)); fVar19 = func_94(uParam0, uParam0->f_175[uParam0->f_92 /*10*/], uParam0->f_9); fVar15 = (uParam0->f_74 * fVar19); func_91(255, 0, 0, 0.5f, 1); if ((SYSTEM::TIMERA() % 600) < 300) { func_90(0.5f, 0.68f, "scan", 1); } fVar19 = func_94(uParam0, uParam0->f_175[uParam0->f_92 /*10*/], uParam0->f_9); fVar15 = 0.03f; GRAPHICS::SET_DRAW_ORIGIN(ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[uParam0->f_92 /*10*/], 0), 0); func_88(uParam0, uParam0->f_175[uParam0->f_92 /*10*/], uParam0->f_175[uParam0->f_92 /*10*/].f_3, fVar19); GRAPHICS::CLEAR_DRAW_ORIGIN(); } else { if (MISC::IS_BIT_SET(uParam0->f_175[uParam0->f_92 /*10*/].f_2, 3)) { MISC::SET_BIT(&(uParam0->f_175[uParam0->f_92 /*10*/].f_2), 2); } MISC::SET_BIT(&(uParam0->f_175[uParam0->f_92 /*10*/].f_2), 0); uParam0->f_55 = uParam0->f_175[uParam0->f_92 /*10*/]; if (uParam0->f_206 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_206)) { AUDIO::STOP_SOUND(uParam0->f_206); } } if (uParam0->f_175[uParam0->f_92 /*10*/].f_4 == 2) { if (uParam0->f_207 != -1) { if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_207)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_207, "COP_HELI_CAM_SCAN_PED_SUCCESS", 0, true); } } } else if (uParam0->f_208 != -1) { if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_208)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_208, "COP_HELI_CAM_SCAN_PED_FAILURE", 0, true); } } } } else { fVar19 = func_94(uParam0, uParam0->f_175[uParam0->f_92 /*10*/], uParam0->f_9); fVar15 = (uParam0->f_74 * fVar19); func_91(255, 0, 0, 0.5f, 1); func_90(0.5f, 0.68f, "HUD_RNG", 0); if (!uParam0->f_201) { if (uParam0->f_209 != -1) { if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_209)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_209, "COP_HELI_CAM_BLEEP_TOO_FAR", 0, true); uParam0->f_201 = 1; } } } } } else if (uParam0->f_201 == 1) { if (uParam0->f_209 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_209)) { AUDIO::STOP_SOUND(uParam0->f_209); } } uParam0->f_201 = 0; } } else if (PAD::IS_CONTROL_PRESSED(2, 229) || (MISC::GET_GAME_TIMER() < uParam0->f_94 && uParam0->f_93 == uParam0->f_92)) { if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_175[uParam0->f_92 /*10*/], false)) { if ((SYSTEM::TIMERA() - uParam0->f_175[uParam0->f_92 /*10*/].f_1) < 500) { if (!uParam0->f_53) { uParam0->f_93 = uParam0->f_92; uParam0->f_94 = MISC::GET_GAME_TIMER() + 3000; GRAPHICS::SET_DRAW_ORIGIN(ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_175[uParam0->f_92 /*10*/], 0), 0); fVar19 = func_94(uParam0, uParam0->f_175[uParam0->f_92 /*10*/], uParam0->f_9); fVar8 = 0f; fVar9 = 0f; func_92(uParam0, uParam0->f_175[uParam0->f_92 /*10*/].f_4, &iVar5, &iVar6, &iVar7); GRAPHICS::CLEAR_DRAW_ORIGIN(); if (uParam0->f_175[uParam0->f_92 /*10*/].f_4 == 2) { func_87(uParam0, uParam0->f_92, ((fVar8 - (fVar15 / 2f)) + (fVar15 * 0.04f)), ((fVar9 + fVar15) + 0.005f), iVar5, iVar6, iVar7, fVar19, 1); } else { func_87(uParam0, uParam0->f_92, ((fVar8 - (fVar15 / 2f)) + (fVar15 * 0.04f)), ((fVar9 + fVar15) + 0.005f), iVar5, iVar6, iVar7, fVar19, 0); } } } } } } if (uParam0->f_49 == 0) { if (uParam0->f_206 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_206)) { AUDIO::STOP_SOUND(uParam0->f_206); } } } } if (uParam0->f_162 > 0) { iVar4 = 0; while (iVar4 <= 0) { if (uParam0->f_163[iVar4 /*11*/].f_5 != -1) { if (GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(uParam0->f_163[iVar4 /*11*/], &fVar8, &fVar9)) { if (ENTITY::DOES_ENTITY_EXIST(uParam0->f_8) && VEHICLE::IS_VEHICLE_DRIVEABLE(uParam0->f_8, false)) { Var26 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_8, true) }; } else if (ENTITY::DOES_ENTITY_EXIST(uParam0->f_9) && !ENTITY::IS_ENTITY_DEAD(uParam0->f_9, false)) { Var26 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_9, true) }; } GRAPHICS::SET_DRAW_ORIGIN(uParam0->f_163[iVar4 /*11*/], 0); fVar8 = 0f; fVar9 = 0f; if (uParam0->f_163[iVar4 /*11*/].f_6 == 1) { fVar14 = MISC::GET_DISTANCE_BETWEEN_COORDS(uParam0->f_163[iVar4 /*11*/], Var26, true); fVar19 = (uParam0->f_79 / (uParam0->f_40 * fVar14)); if (fVar19 < 0.4f) { fVar19 = 0.4f; } if (fVar19 > 2f) { fVar19 = 2f; } func_93(uParam0, uParam0->f_163[iVar4 /*11*/], fVar19, 0, -1, -1, -1); GRAPHICS::SET_DRAW_ORIGIN(uParam0->f_163[iVar4 /*11*/], 0); } else { GRAPHICS::DRAW_SPRITE("helicopterhud", "hud_dest", fVar8, fVar9, 0.042f, 0.042f, 0f, uParam0->f_163[iVar4 /*11*/].f_8, uParam0->f_163[iVar4 /*11*/].f_9, uParam0->f_163[iVar4 /*11*/].f_10, 255, true); } GRAPHICS::CLEAR_DRAW_ORIGIN(); } else if (uParam0->f_163[iVar4 /*11*/].f_6 == 1) { func_95(uParam0, uParam0->f_163[iVar4 /*11*/], uParam0->f_163[iVar4 /*11*/].f_8, uParam0->f_163[iVar4 /*11*/].f_9, uParam0->f_163[iVar4 /*11*/].f_10); } else { func_95(uParam0, uParam0->f_163[iVar4 /*11*/], uParam0->f_163[iVar4 /*11*/].f_8, uParam0->f_163[iVar4 /*11*/].f_9, uParam0->f_163[iVar4 /*11*/].f_10); } } iVar4++; } } if (iParam1 == 0) { fVar27 = uParam0->f_42.f_2; if (func_191(uParam0->f_8) || func_86()) { fVar27 = uParam0->f_186.f_2; } Var28 = { 0f, 0f, 0f }; if (ENTITY::DOES_ENTITY_EXIST(uParam0->f_9)) { if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_9, false)) { Var28 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_9, true) }; fVar30 = ENTITY::GET_ENTITY_HEADING(uParam0->f_9); } } if (Global_1319110 != -1) { if (Global_1319110 == 2 || Global_1319110 == 3) { fVar30 = (fVar30 - 174.4552f); } } while (fVar27 < 0f) { fVar27 = (fVar27 + 360f); } while (fVar27 > 360f) { fVar27 = (fVar27 - 360f); } while (fVar30 < 0f) { fVar30 = (fVar30 + 360f); } while (fVar30 > 360f) { fVar30 = (fVar30 - 360f); } fVar33 = fVar27; if (Global_1319110 != -1) { fVar31 = (fVar30 - MISC::ABSF(fParam3)); fVar32 = (fVar30 + MISC::ABSF(fParam2)); } else if (func_191(uParam0->f_8) || func_86()) { fVar31 = -(uParam0->f_25 * 0.5f); fVar32 = (uParam0->f_25 * 0.5f); } else { fVar31 = (fVar30 - uParam0->f_25); fVar32 = (fVar30 + uParam0->f_25); } if (fVar33 < fVar31 && (fVar33 + 360f) <= fVar32) { fVar33 = (fVar33 + 360f); } if (fVar33 > fVar32 && (fVar33 - 360f) >= fVar31) { fVar33 = (fVar33 - 360f); } fVar29 = ((fVar33 - fVar31) / (fVar32 - fVar31)); if (fVar29 == 2f) { fVar29 = 0f; } else if (fVar29 == -1f) { fVar29 = 1f; } else if (fVar29 < 0f && fVar29 >= -0.5f) { fVar29 = 0f; } else if (fVar29 < 0f && fVar29 > -1f) { fVar29 = 1f; } else if (fVar29 > 1.5f && fVar29 < 2f) { fVar29 = 0f; } else if (fVar29 > 2f || fVar29 < -1f) { fVar29 = 0.5f; } GRAPHICS::BEGIN_SCALEFORM_MOVIE_METHOD(iLocal_69, "SET_ALT_FOV_HEADING"); GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_FLOAT(Var28.f_2); if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_FLOAT(fVar29); } else { GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_FLOAT(((uParam0->f_40 - uParam0->f_39) / (uParam0->f_38 - uParam0->f_39))); } GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_FLOAT(fVar27); GRAPHICS::END_SCALEFORM_MOVIE_METHOD(); HUD::HIDE_HUD_COMPONENT_THIS_FRAME(3); if (!uParam0->f_51) { HUD::HIDE_HUD_AND_RADAR_THIS_FRAME(); } } } } } int func_86() { if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { return 1; } return 0; } int func_87(var uParam0, int iParam1, float fParam2, float fParam3, int iParam4, int iParam5, int iParam6, float fParam7, bool bParam8) { struct<2> Var0; int iVar1; int iVar2; func_91(iParam4, iParam5, iParam6, 0.43f, bParam8); if (fParam7 < 0.7f) { fParam7 = 0.7f; } if (fParam7 > 1.5f) { fParam7 = 1.5f; } if (MISC::IS_BIT_SET(uParam0->f_175[iParam1 /*10*/].f_2, 8)) { } iVar1 = 24; while (iVar1 <= 31) { if (MISC::IS_BIT_SET(uParam0->f_175[iParam1 /*10*/].f_5, iVar1)) { StringCopy(&Var0, "crimes_", 16); StringIntConCat(&Var0, (iVar1 - 23), 16); func_91(iParam4, iParam5, iParam6, 0.43f, bParam8); func_90(0.5f, (0.68f + (0.037f * IntToFloat(iVar2 + 1))), &Var0, 1); iVar2++; } iVar1++; } if (iVar2 == 0) { func_91(iParam4, iParam5, iParam6, 0.43f, bParam8); func_90(fParam2, (fParam3 + (uParam0->f_196 * fParam7)), "unknown", 1); } if (uParam0->f_175[iParam1 /*10*/].f_4 == 0) { func_91(iParam4, iParam5, iParam6, 0.43f, bParam8); func_90(fParam2, (fParam3 + (uParam0->f_196 * fParam7)), "HUD_ID2", 1); } return 1; } void func_88(var uParam0, int iParam1, float fParam2, float fParam3) { struct<3> Var0; struct<3> Var1; float fVar2; float fVar3; float fVar4; float fVar5; float fVar6; float fVar7; struct<3> Var8; float fVar9; float fVar10; Var8 = { 0f, 0f, 0f }; if (fParam2 < 0.5f) { if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 14201, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 63931, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 52301, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 36864, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); } if (fParam2 > 0.15f && fParam2 < 0.7f) { if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 36864, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 51826, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.15f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 63931, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 58271, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.15f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); } if (fParam2 > 0.3f && fParam2 < 1f) { if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 11816, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 39317, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.3f; fVar10 = 0.5f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 2f); } if (fParam2 > 0.6f && fParam2 < 1f) { if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 31086, Var8) }; Var1 = { Var0 + Var0 - PED::GET_PED_BONE_COORDS(iParam1, 39317, Var8) * Vector(3f, 3f, 3f) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.6f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1.3f); } if (fParam2 > 0.6f && fParam2 < 1f) { if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 40269, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 28252, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.6f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 45509, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 61163, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.6f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); } if (fParam2 > 0.75f && fParam2 < 1f) { if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 28252, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 57005, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.75f; fVar10 = 0.25f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); if (!PED::IS_PED_INJURED(iParam1)) { Var0 = { PED::GET_PED_BONE_COORDS(iParam1, 61163, Var8) }; Var1 = { PED::GET_PED_BONE_COORDS(iParam1, 18905, Var8) }; GRAPHICS::SET_DRAW_ORIGIN(Var0, 0); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var0, &fVar4, &fVar5); GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Var1, &fVar6, &fVar7); fVar2 = ((fVar6 - fVar4) / 10f); fVar3 = ((fVar7 - fVar5) / 10f); } fVar9 = 0.75f; fVar10 = 0.3f; func_89(uParam0, fParam2, fVar9, fVar10, fVar2, fVar3, fParam3, fVar6, fVar4, fVar7, fVar5, 1065353216); } GRAPHICS::CLEAR_DRAW_ORIGIN(); } void func_89(var uParam0, float fParam1, float fParam2, float fParam3, float fParam4, float fParam5, float fParam6, float fParam7, float fParam8, float fParam9, float fParam10, float fParam11) { int iVar0; float fVar1; float fVar2; fVar2 = (fParam3 / 10f); iVar0 = 0; while (iVar0 <= 10) { fVar1 = (fParam1 - (fParam2 + (IntToFloat(iVar0) * fVar2))); if (fVar1 > 0f && fVar1 < 0.3f) { fVar1 = SYSTEM::SIN((fVar1 * 600f)); GRAPHICS::DRAW_SPRITE("helicopterhud", "hud_line", (fParam4 * IntToFloat(iVar0)), (fParam5 * IntToFloat(iVar0)), ((fParam6 * fParam11) * 0.01f), ((fParam6 * fParam11) * 0.01f), MISC::GET_ANGLE_BETWEEN_2D_VECTORS(0f, 1f, (fParam7 - fParam8), (fParam9 - fParam10)), uParam0->f_71, uParam0->f_71.f_1, uParam0->f_71.f_2, SYSTEM::FLOOR((fVar1 * 32f)), true); } iVar0++; } } void func_90(float fParam0, float fParam1, char* sParam2, int iParam3) { HUD::BEGIN_TEXT_COMMAND_DISPLAY_TEXT(sParam2); HUD::END_TEXT_COMMAND_DISPLAY_TEXT(fParam0, fParam1, iParam3); } void func_91(int iParam0, int iParam1, int iParam2, float fParam3, bool bParam4) { HUD::SET_TEXT_SCALE(fParam3, fParam3); HUD::SET_TEXT_COLOUR(iParam0, iParam1, iParam2, 150); if (bParam4) { HUD::SET_TEXT_DROPSHADOW(5, 0, 0, 0, 255); } HUD::SET_TEXT_CENTRE(true); HUD::SET_TEXT_FONT(0); } int func_92(var uParam0, int iParam1, int iParam2, int iParam3, int iParam4) { switch (iParam1) { case 0: *iParam2 = uParam0->f_62; *iParam3 = uParam0->f_62.f_1; *iParam4 = uParam0->f_62.f_2; return 1; break; case 1: *iParam2 = 255; *iParam3 = 255; *iParam4 = 0; return 1; break; case 2: *iParam2 = uParam0->f_65; *iParam3 = uParam0->f_65.f_1; *iParam4 = uParam0->f_65.f_2; return 1; break; case 3: *iParam2 = uParam0->f_68; *iParam3 = uParam0->f_68.f_1; *iParam4 = uParam0->f_68.f_2; return 1; break; } return 0; } void func_93(var uParam0, struct<3> Param1, float fParam2, int iParam3, int iParam4, int iParam5, int iParam6) { int iVar0; int iVar1; int iVar2; func_92(uParam0, iParam3, &iVar0, &iVar1, &iVar2); GRAPHICS::SET_DRAW_ORIGIN(Param1, 0); if (iParam4 != -1) { iVar0 = iParam4; iVar1 = iParam5; iVar2 = iParam6; } fParam2 = (fParam2 * 0.03f); GRAPHICS::DRAW_SPRITE("helicopterhud", "hud_corner", (-fParam2 * 0.5f), -fParam2, 0.013f, 0.013f, 0f, iVar0, iVar1, iVar2, 200, true); GRAPHICS::DRAW_SPRITE("helicopterhud", "hud_corner", (fParam2 * 0.5f), -fParam2, 0.013f, 0.013f, 90f, iVar0, iVar1, iVar2, 200, true); GRAPHICS::DRAW_SPRITE("helicopterhud", "hud_corner", (-fParam2 * 0.5f), fParam2, 0.013f, 0.013f, 270f, iVar0, iVar1, iVar2, 200, true); GRAPHICS::DRAW_SPRITE("helicopterhud", "hud_corner", (fParam2 * 0.5f), fParam2, 0.013f, 0.013f, 180f, iVar0, iVar1, iVar2, 200, true); GRAPHICS::CLEAR_DRAW_ORIGIN(); } float func_94(var uParam0, int iParam1, int iParam2) { struct<3> Var0; float fVar1; float fVar2; if (!ENTITY::IS_ENTITY_DEAD(iParam1, false)) { Var0 = { ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(iParam1, 0) }; if (!ENTITY::IS_ENTITY_DEAD(iParam2, false)) { fVar1 = MISC::GET_DISTANCE_BETWEEN_COORDS(Var0, ENTITY::GET_ENTITY_COORDS(iParam2, true), true); fVar2 = (uParam0->f_79 / (uParam0->f_40 * fVar1)); if (fVar2 < 0.4f) { fVar2 = 0.4f; } if (fVar2 > 2f) { fVar2 = 2f; } return fVar2; } } return 0f; } void func_95(var uParam0, struct<3> Param1, int iParam2, int iParam3, int iParam4) { var uVar0; struct<3> Var1; struct<3> Var2; float fVar3; float fVar4; float fVar5; float fVar6; float fVar7; float fVar8; float fVar9; if (CAM::DOES_CAM_EXIST(CAM::GET_RENDERING_CAM())) { if (!GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Param1, &uVar0, &uVar0)) { Var1 = { CAM::GET_CAM_COORD(CAM::GET_RENDERING_CAM()) }; Var2 = { CAM::GET_CAM_ROT(CAM::GET_RENDERING_CAM(), 2) }; fVar3 = MISC::GET_DISTANCE_BETWEEN_COORDS(Var1.x, Var1.f_1, 0f, Param1.x, Param1.f_1, 0f, true); fVar4 = (Param1.f_2 - Var1.f_2); if (fVar3 > 0f) { fVar5 = MISC::ATAN((fVar4 / fVar3)); } else { fVar5 = 0f; } fVar6 = func_96(Var1, Param1, 0); fVar7 = MISC::ATAN2(((SYSTEM::COS(Var2.x) * SYSTEM::SIN(fVar5)) - ((SYSTEM::SIN(Var2.x) * SYSTEM::COS(fVar5)) * SYSTEM::COS(((fVar6 * -1f) - Var2.f_2)))), (SYSTEM::SIN(((fVar6 * -1f) - Var2.f_2)) * SYSTEM::COS(fVar5))); if (uParam0->f_10 > 0f) { } fVar8 = (0.5f - (SYSTEM::COS(fVar7) * 0.29f)); fVar9 = (0.5f - (SYSTEM::SIN(fVar7) * 0.29f)); GRAPHICS::DRAW_SPRITE("helicopterhud", "hudArrow", fVar8, fVar9, 0.02f, 0.04f, (fVar7 - 90f), iParam2, iParam3, iParam4, 255, true); HUD::SET_TEXT_CENTRE(true); } } } float func_96(struct<2> Param0, var uParam1, struct<2> Param2, var uParam3, int iParam4) { float fVar0; float fVar1; float fVar2; fVar1 = (Param2 - Param0); fVar2 = (Param2.f_1 - Param0.f_1); if (fVar2 != 0f) { fVar0 = MISC::ATAN2(fVar1, fVar2); } else if (fVar1 < 0f) { fVar0 = -90f; } else { fVar0 = 90f; } if (iParam4 == 1) { fVar0 = (fVar0 * -1f); if (fVar0 < 0f) { fVar0 = (fVar0 + 360f); } } return fVar0; } void func_97(var uParam0) { if (uParam0->f_200 == 0) { if (AUDIO::REQUEST_AMBIENT_AUDIO_BANK("SCRIPT\POLICE_CHOPPER_CAM", false, -1)) { uParam0->f_200 = 1; uParam0->f_202 = AUDIO::GET_SOUND_ID(); uParam0->f_203 = AUDIO::GET_SOUND_ID(); uParam0->f_205 = AUDIO::GET_SOUND_ID(); uParam0->f_204 = AUDIO::GET_SOUND_ID(); uParam0->f_206 = AUDIO::GET_SOUND_ID(); uParam0->f_207 = AUDIO::GET_SOUND_ID(); uParam0->f_208 = AUDIO::GET_SOUND_ID(); uParam0->f_209 = AUDIO::GET_SOUND_ID(); } } } void func_98(var uParam0) { int iVar0; iVar0 = 0; while (iVar0 < uParam0->f_163) { if (uParam0->f_163[iVar0 /*11*/].f_5 != -1) { if (uParam0->f_163[iVar0 /*11*/].f_3 != 0) { if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_163[iVar0 /*11*/].f_3, false)) { uParam0->f_163[iVar0 /*11*/] = { ENTITY::GET_ENTITY_COORDS(uParam0->f_163[iVar0 /*11*/].f_3, true) }; } } if (uParam0->f_163[iVar0 /*11*/].f_4 != 0) { if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_163[iVar0 /*11*/].f_4, false)) { uParam0->f_163[iVar0 /*11*/] = { ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(uParam0->f_163[iVar0 /*11*/].f_4, 0) }; } } } iVar0++; } } void func_99(var uParam0, float fParam1, float fParam2, float fParam3, float fParam4, float fParam5) { int iVar0; int iVar1; int iVar2; float fVar3; float fVar4; float fVar5; struct<3> Var6; float fVar7; struct<3> Var8; struct<3> Var9; struct<3> Var10; struct<3> Var11; struct<3> Var12; struct<3> Var13; float fVar14; int iVar15; struct<3> Var16; float fVar17; struct<3> Var18; bool bVar19; float fVar20; float fVar21; int iVar22; float fVar23; float fVar24; struct<3> Var25; struct<3> Var26; float fVar27; int iVar28; float fVar29; float fVar30; int iVar31; struct<3> Var32; float fVar33; struct<3> Var34; struct<3> Var35; struct<3> Var36; int iVar37; int iVar38; float fVar39; struct<3> Var40; float fVar41; fVar5 = fParam2; if (uParam0->f_214) { fVar5 = -25f; } if (uParam0->f_33 == 1) { if (CAM::DOES_CAM_EXIST(uParam0->f_32)) { if (!CAM::IS_CAM_ACTIVE(uParam0->f_32)) { CAM::SET_CAM_ACTIVE(uParam0->f_32, true); if (Global_1319110 != -1 || Global_1319116 != -1) { uParam0->f_213 = 1; } else { CAM::RENDER_SCRIPT_CAMS(true, false, 3000, true, false, 0); } } } if (uParam0->f_35) { if (CAM::DOES_CAM_EXIST(uParam0->f_32)) { Var6 = { CAM::GET_CAM_COORD(uParam0->f_32) }; Global_1573326 = 1; if (MISC::GET_GROUND_Z_FOR_3D_COORD(Var6.x, Var6.f_1, (Var6.f_2 + 1f), &fVar7, false, false) || ENTITY::IS_ENTITY_IN_WATER(uParam0->f_8)) { if (fVar7 > Var6.f_2) { if (Global_1319110 != -1 || Global_1319116 != -1) { if (uParam0->f_210 > 10) { if (ENTITY::GET_ENTITY_SUBMERGED_LEVEL(uParam0->f_8) >= 0.01f) { if (Global_1319110 != -1 || Global_1319116 != -1) { func_48("TUR_WATER", -1); uParam0->f_34 = 1; } } if (MISC::GET_GROUND_Z_FOR_3D_COORD(Var6.x, Var6.f_1, (Var6.f_2 - 1f), &fVar7, false, false)) { } else { if (Global_1319116 != -1) { func_48("TUR_GR", -1); } uParam0->f_34 = 1; } } else { uParam0->f_210++; } } else { uParam0->f_34 = 1; } } else if (uParam0->f_210 != 0) { uParam0->f_210 = 0; } } } } if (uParam0->f_35 == 0) { if (CAM::DOES_CAM_EXIST(uParam0->f_32)) { if (ENTITY::DOES_ENTITY_EXIST(uParam0->f_9)) { if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_9, false)) { if (uParam0->f_4) { switch (ENTITY::GET_ENTITY_MODEL(uParam0->f_9)) { case joaat("valkyrie"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 5.32f, -0.3f, true); break; case joaat("polmav"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 2.75f, -1.25f, true); break; case joaat("maverick"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 2.75f, -1.25f, true); break; case joaat("savage"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 5.75f, -0.75f, true); break; case joaat("hunter"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, -0.0066f, 8.9038f, -0.5f, true); break; case joaat("trailerlarge"): switch (Global_1319110) { case 1: Var8 = { 0f, 8.4f, 1.3f }; break; case 2: Var8 = { -2.4f, -7.6f, 0.92f }; break; case 3: Var8 = { 2.4f, -7.6f, 0.92f }; break; } CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, Var8, true); break; case joaat("adder"): Var9 = { 2065.848f, 2967.32f, 45.2947f }; Var10 = { 2049.612f, 2947.657f, 49.556f }; Var11 = { 2045.091f, 2943.258f, 49.4991f }; Var12 = { 2040.365f, 2952.754f, 49.5688f }; Var13 = { 2049.385f, 2953.971f, 49.9635f }; switch (Global_1319116) { case 1: Var8 = { Var10 - Var9 }; break; case 2: Var8 = { Var11 - Var9 }; break; case 3: Var8 = { Var12 - Var9 }; break; case 4: Var8 = { Var13 - Var9 }; break; } CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, Var8, true); break; default: CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 1.958f, -0.618f, true); break; } } else { switch (ENTITY::GET_ENTITY_MODEL(uParam0->f_9)) { case joaat("buzzard"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 1.958f, -0.468f, true); break; case joaat("polmav"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 2.75f, -1.25f, true); break; case joaat("buzzard2"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 1.958f, -0.618f, true); break; case joaat("valkyrie"): CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 5.32f, -0.3f, true); break; default: CAM::ATTACH_CAM_TO_ENTITY(uParam0->f_32, uParam0->f_9, 0f, 1.958f, -0.618f, true); break; } } uParam0->f_35 = 1; } } } } if (uParam0->f_35 == 1 && uParam0->f_7 == 0) { fVar14 = 128f; if (CAM::DOES_CAM_EXIST(uParam0->f_32)) { if (CAM::IS_CAM_ACTIVE(uParam0->f_32)) { if (!func_104(1)) { if (!PAD::IS_CONTROL_PRESSED(2, 19) && !HUD::IS_PAUSE_MENU_ACTIVE()) { PAD::SET_INPUT_EXCLUSIVE(0, 39); if (PAD::_IS_USING_KEYBOARD(0)) { fVar14 = 15f; fVar3 = (PAD::GET_DISABLED_CONTROL_UNBOUND_NORMAL(0, 291) * -fVar14); fVar4 = (PAD::GET_DISABLED_CONTROL_UNBOUND_NORMAL(0, 290) * fVar14); } else { iVar2 = SYSTEM::FLOOR((PAD::GET_DISABLED_CONTROL_UNBOUND_NORMAL(0, 291) * -fVar14)); iVar1 = SYSTEM::FLOOR((PAD::GET_DISABLED_CONTROL_UNBOUND_NORMAL(0, 290) * fVar14)); } iVar0 = SYSTEM::FLOOR((PAD::GET_DISABLED_CONTROL_NORMAL(0, 39) * 128f)); } if (!PAD::_IS_USING_KEYBOARD(0)) { iVar15 = SYSTEM::ROUND((fParam5 * fVar14)); if (MISC::ABSI(iVar0) < iVar15) { iVar0 = 0; } Var16 = { IntToFloat(iVar2), IntToFloat(iVar1), 0f }; if (SYSTEM::VMAG(Var16) < IntToFloat(iVar15)) { iVar2 = 0; iVar1 = 0; } } fVar17 = ((uParam0->f_42 / fParam2) * 0.5f); if (fVar17 > 0f) { fVar17 = (fVar17 + 1f); } else { fVar17 = 1f; } if (PAD::_IS_USING_KEYBOARD(0)) { uParam0->f_56 = ((fVar3 * uParam0->f_40) * uParam0->f_36); uParam0->f_57 = (((fVar4 * uParam0->f_40) * uParam0->f_36) * fVar17); } else { uParam0->f_56 = (((SYSTEM::TO_FLOAT(iVar2) * uParam0->f_40) * uParam0->f_36) * SYSTEM::TIMESTEP()); uParam0->f_57 = ((((SYSTEM::TO_FLOAT(iVar1) * uParam0->f_40) * uParam0->f_36) * fVar17) * SYSTEM::TIMESTEP()); } uParam0->f_57 = func_103(uParam0->f_57, fParam3, fParam4); if (func_102(uParam0->f_45, 0f, 0f, 0f, 0)) { Var18 = { CAM::GET_CAM_COORD(uParam0->f_32) }; uParam0->f_45 = (SYSTEM::SIN(uParam0->f_42.f_2) * 150f); uParam0->f_45.f_1 = (SYSTEM::COS(uParam0->f_42.f_2) * 150f); uParam0->f_45.f_2 = Var18.f_2; } if (uParam0->f_4) { if ((!func_191(uParam0->f_8) && !func_86()) || Global_1319110 != -1) { if (iVar2 != 0 && iVar1 != 0) { uParam0->f_42 = { CAM::GET_CAM_ROT(uParam0->f_32, 2) }; } } } else { uParam0->f_42 = { CAM::GET_CAM_ROT(uParam0->f_32, 2) }; } if (!func_102(CAM::GET_CAM_COORD(uParam0->f_32), 0f, 0f, 0f, 0)) { if (((uParam0->f_25 != 0f && !func_191(uParam0->f_8)) && !func_86()) || Global_1319110 != -1) { if (VEHICLE::IS_VEHICLE_DRIVEABLE(uParam0->f_8, false)) { fVar20 = ENTITY::GET_ENTITY_HEADING(uParam0->f_8); if (Global_1319110 == 2 || Global_1319110 == 3) { fVar20 = (fVar20 - 174.4552f); } fVar21 = (fVar20 - uParam0->f_42.f_2); while (MISC::ABSF(fVar21) >= 180f && iVar22 < 30) { if (fVar21 < 0f) { fVar21 = (fVar21 + 360f); } else { fVar21 = (fVar21 - 360f); } iVar22++; if (iVar22 == 30) { } } if (Global_1319110 != -1) { if (fVar21 >= fParam4) { bVar19 = true; if (fVar21 > 0f) { uParam0->f_42.f_2 = (fVar20 - fParam4); } else { uParam0->f_42.f_2 = (fVar20 + fParam4); } } if (fVar21 < fParam3) { bVar19 = true; if (fVar21 > 0f) { uParam0->f_42.f_2 = (fVar20 - MISC::ABSF(fParam3)); } else { uParam0->f_42.f_2 = (fVar20 + MISC::ABSF(fParam3)); } } } else if (MISC::ABSF(fVar21) > uParam0->f_25) { bVar19 = true; if (fVar21 > 0f) { uParam0->f_42.f_2 = (fVar20 - uParam0->f_25); } else { uParam0->f_42.f_2 = (fVar20 + uParam0->f_25); } } } } fVar23 = 0f; fVar24 = 0f; if (func_191(uParam0->f_8) || func_86()) { if (func_102(uParam0->f_189, 0f, 0f, 0f, 0)) { Var25 = { ENTITY::GET_ENTITY_ROTATION(uParam0->f_8, 2) }; uParam0->f_189 = { ENTITY::GET_ENTITY_ROTATION(uParam0->f_8, 2) }; } else { Var26 = { ENTITY::GET_ENTITY_ROTATION(uParam0->f_8, 2) }; if (func_191(uParam0->f_8)) { switch (Global_1319115) { case 0: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; case 1: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; case 2: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / -90f); break; default: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; } } if (func_86()) { switch (ENTITY::GET_ENTITY_MODEL(uParam0->f_8)) { case joaat("avenger"): switch (Global_1319116) { case 1: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; case 2: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / -90f); break; case 3: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / -90f); break; default: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; } break; default: switch (Global_1319116) { case 1: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; case 2: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; case 3: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / -90f); break; default: fVar27 = ((MISC::ABSF(uParam0->f_186.f_2) - 90f) / 90f); break; } break; } } fVar23 = (fVar23 - ((Var26.x - uParam0->f_189) * fVar27)); fVar24 = (fVar24 + (Var26.f_2 - uParam0->f_189.f_2)); if (fVar24 > 180f) { fVar24 = (fVar24 - 360f); } if (fVar24 < -180f) { fVar24 = (fVar24 + 360f); } if (Var26.x < -80f || Var26.x > 80f) { fVar23 = 0f; fVar24 = 0f; } if (ENTITY::IS_ENTITY_UPSIDEDOWN(uParam0->f_8)) { fVar23 = 0f; fVar24 = 0f; } uParam0->f_189 = { Var26 }; } } if (func_191(uParam0->f_8)) { if (uParam0->f_57 != 0f && !(uParam0->f_186.f_2 == (-uParam0->f_25 / 2f) || uParam0->f_186.f_2 == (uParam0->f_25 / 2f))) { iLocal_68 = 0; iLocal_67 = 0; } else if (uParam0->f_56 != 0f && !(uParam0->f_186 == fVar5 || uParam0->f_186 == fParam1)) { iLocal_68 = 0; iLocal_67 = 0; } else if (iLocal_67 > 5) { iLocal_68 = 1; } iLocal_67++; } if (((uParam0->f_56 != 0f || uParam0->f_57 != 0f) || fVar23 != 0f) || fVar24 != 0f) { if (VEHICLE::IS_VEHICLE_DRIVEABLE(uParam0->f_8, false)) { iVar28 = ENTITY::GET_ENTITY_MODEL(uParam0->f_8); } if (Global_1319115 != -1 || Global_1319116 != -1) { if (!func_124(3)) { fVar29 = (((uParam0->f_40 - (uParam0->f_39 - 1f)) / (uParam0->f_38 - (uParam0->f_39 - 1f))) * 6f); } else if (func_75(PLAYER::PLAYER_ID()) || func_124(3)) { fVar29 = (((uParam0->f_40 - (uParam0->f_39 - 1f)) / (uParam0->f_38 - (uParam0->f_39 - 1f))) * 8f); } if (fVar29 < 3f) { fVar29 = 3f; } uParam0->f_56 = (uParam0->f_56 * fVar29); uParam0->f_57 = (uParam0->f_57 * fVar29); } else if (iVar28 == joaat("hunter")) { uParam0->f_56 = (uParam0->f_56 * 4f); uParam0->f_57 = (uParam0->f_57 * 4f); } if (func_191(uParam0->f_8) || func_86()) { uParam0->f_186 = (uParam0->f_186 + uParam0->f_56); uParam0->f_186.f_2 = (uParam0->f_186.f_2 - uParam0->f_57); uParam0->f_186 = (uParam0->f_186 - fVar23); uParam0->f_186.f_2 = (uParam0->f_186.f_2 - fVar24); if (uParam0->f_186 < fVar5) { uParam0->f_186 = fVar5; } if (uParam0->f_186 > fParam1) { uParam0->f_186 = fParam1; } if (uParam0->f_25 >= 360f) { while (uParam0->f_186.f_2 > 180f) { uParam0->f_186.f_2 = (uParam0->f_186.f_2 - 360f); } while (uParam0->f_186.f_2 < -180f) { uParam0->f_186.f_2 = (uParam0->f_186.f_2 + 360f); } } else { if (uParam0->f_186.f_2 < (-uParam0->f_25 / 2f)) { uParam0->f_186.f_2 = (-uParam0->f_25 / 2f); bVar19 = true; } if (uParam0->f_186.f_2 > (uParam0->f_25 / 2f)) { uParam0->f_186.f_2 = (uParam0->f_25 / 2f); bVar19 = true; } } } else { iLocal_67++; uParam0->f_42 = { uParam0->f_42 + Vector(-uParam0->f_57, 0f, uParam0->f_56) }; if (uParam0->f_42 < fVar5) { uParam0->f_42 = fVar5; } if (uParam0->f_42 > fParam1) { uParam0->f_42 = fParam1; } if (iLocal_67 > 5) { if (!func_73(Local_66, uParam0->f_42, 0.05f, 0)) { Local_66 = { uParam0->f_42 }; iLocal_68 = 0; } else { iLocal_68 = 1; } iLocal_67 = 0; } } if (uParam0->f_203 != -1) { if (bVar19) { fVar30 = 0f; } else { fVar30 = (fVar30 + MISC::ABSF(uParam0->f_57)); if (MISC::ABSF(uParam0->f_57) > 0f) { iLocal_68 = 0; } } if (func_191(uParam0->f_8) || func_86()) { if (uParam0->f_186 < fParam1 && uParam0->f_186 > fParam2) { fVar30 = (fVar30 + MISC::ABSF(uParam0->f_56)); if (MISC::ABSF(uParam0->f_56) > 0f) { iLocal_68 = 0; } } } else if (uParam0->f_42 < fParam1 && uParam0->f_42 > fParam2) { fVar30 = (fVar30 + MISC::ABSF(uParam0->f_56)); if (MISC::ABSF(uParam0->f_56) > 0f) { iLocal_68 = 0; } } if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_203) && !iLocal_68) { if (func_124(3)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_203, "Pan_Loop", func_3(3), true); } else { iVar31 = func_101(); if (iVar31 != 0) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_203, "Pan", func_3(iVar31), true); } else { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_203, "COP_HELI_CAM_TURN", 0, true); } } } if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_203)) { if (!iLocal_68 && fVar30 > 0f) { AUDIO::SET_VARIABLE_ON_SOUND(uParam0->f_203, "Ctrl", fVar30); } else { AUDIO::STOP_SOUND(uParam0->f_203); iLocal_68 = 1; iLocal_67 = 6; } } } } else if (uParam0->f_203 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_203)) { AUDIO::STOP_SOUND(uParam0->f_203); iLocal_68 = 1; iLocal_67 = 6; } } if ((!func_191(uParam0->f_8) && !func_86()) || Global_1319110 != -1) { Var32 = { uParam0->f_159 }; if (uParam0->f_4) { fVar33 = 150f; } else { fVar33 = MISC::GET_DISTANCE_BETWEEN_COORDS(Var32, CAM::GET_CAM_COORD(uParam0->f_32), true); } uParam0->f_45 = ((SYSTEM::COS(uParam0->f_42) * fVar33) * SYSTEM::SIN(-uParam0->f_42.f_2)); uParam0->f_45.f_1 = ((SYSTEM::COS(uParam0->f_42) * fVar33) * SYSTEM::COS(-uParam0->f_42.f_2)); uParam0->f_45.f_2 = (SYSTEM::SIN(uParam0->f_42) * fVar33); uParam0->f_45 = { uParam0->f_45 + CAM::GET_CAM_COORD(uParam0->f_32) }; CAM::POINT_CAM_AT_COORD(uParam0->f_32, uParam0->f_45); } else { if (ENTITY::GET_ENTITY_MODEL(uParam0->f_9) == joaat("volatol")) { switch (Global_1319115) { case 1: Var36 = { 0f, 7.1f, -1.52f }; Var34 = { Var36 + func_100(0f, 0.18f, 0f, uParam0->f_186.f_2) }; Var35 = { -7f, 0f, 0f }; break; case 2: Var36 = { 0f, 4.7f, 2.56f }; Var34 = { Var36 + func_100(0f, 0f, 0.5f, uParam0->f_186.f_2) }; Var35 = { -5.8f, 0f, 0f }; break; } } if (ENTITY::GET_ENTITY_MODEL(uParam0->f_9) == joaat("bombushka")) { switch (Global_1319115) { case 0: Var34 = { Vector(2.43f, -4.26f, -3.42f) + Vector(0f, -1.25f, 2.82f) }; Var35 = { 0f, 0f, 0f }; break; case 1: if (!ENTITY::IS_ENTITY_DEAD(uParam0->f_8, false) && VEHICLE::GET_VEHICLE_MOD(uParam0->f_8, 10) == 0) { Var34 = { Vector(-1.5f, -0.22f, -5.2f) + Vector(-0.4f, 0f, 0.2f) }; Var35 = { 0f, 0f, 90f }; } else { Var34 = { -5.2f, -0.3f, -1.5f }; Var35 = { 0f, 0f, 90f }; } break; case 2: Var34 = { 23f, -0.18f, 1.23f }; Var35 = { 0f, 0f, -90f }; break; } } if (ENTITY::GET_ENTITY_MODEL(uParam0->f_9) == joaat("avenger")) { switch (Global_1319116) { case 1: Var34 = { 0f, 9.8f, -2.315f }; Var35 = { 0f, 0f, 0f }; break; case 2: Var34 = { 0f, -1.85f, 2.65f }; Var35 = { 0f, 0f, 180f }; break; case 3: Var34 = { 0f, -9.5f, 0.11f }; Var35 = { 0f, 0f, 180f }; break; } } if (ENTITY::GET_ENTITY_MODEL(uParam0->f_9) == joaat("akula")) { switch (Global_1319115) { case 0: Var34 = { 0f, 9f, -1.2f }; Var35 = { -10.2537f, 0f, 0f }; break; case 1: Var34 = { -1.26f, 3.278f, 0.695f }; Var35 = { 0f, 0f, 90f }; break; case 2: Var34 = { 1.26f, 3.278f, 0.695f }; Var35 = { 0f, 0f, -90f }; break; } } if (ENTITY::GET_ENTITY_MODEL(uParam0->f_9) == joaat("phantom3")) { switch (Global_1319115) { case 0: Var34 = { 0f, 0f, 0f }; Var35 = { 0f, 0f, 0f }; break; case 1: Var34 = { 0f, 0f, 0f }; Var35 = { 0f, 0f, 0f }; break; } } if (ENTITY::GET_ENTITY_MODEL(uParam0->f_8) == joaat("bombushka")) { CAM::_ATTACH_CAM_TO_PED_BONE_2(uParam0->f_32, PLAYER::PLAYER_PED_ID(), -1, Var35 + Vector(uParam0->f_186.f_2, 0f, uParam0->f_186), Var34, true); } else if (Global_1319116 != -1 || (func_191(uParam0->f_8) && ENTITY::GET_ENTITY_MODEL(uParam0->f_8) != joaat("bombushka"))) { CAM::_ATTACH_CAM_TO_VEHICLE_BONE(uParam0->f_32, uParam0->f_9, 0, true, Var35 + Vector(uParam0->f_186.f_2, 0f, uParam0->f_186), Var34, true); } } } if (!((iVar0 == 0 || uParam0->f_40 == uParam0->f_38) || uParam0->f_40 == uParam0->f_39)) { if (uParam0->f_202 != -1) { if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_202)) { if (func_124(3)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_202, "Zoom_Loop", func_3(3), true); } else { iVar37 = func_101(); if (iVar37 != 0) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_202, "Zoom", func_3(iVar37), true); } else { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_202, "COP_HELI_CAM_ZOOM", 0, true); } } } } if (uParam0->f_202 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_202)) { AUDIO::SET_VARIABLE_ON_SOUND(uParam0->f_202, "Ctrl", MISC::ABSF((SYSTEM::TO_FLOAT(iVar0) / 128f))); if (iVar0 < 0) { AUDIO::SET_VARIABLE_ON_SOUND(uParam0->f_202, "Dir", -1f); } } } } else if (uParam0->f_202 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_202)) { AUDIO::STOP_SOUND(uParam0->f_202); } } iVar38 = 4; if (func_124(3)) { uParam0->f_37 = 5f; } if (func_191(uParam0->f_8) || func_86()) { uParam0->f_40 = (uParam0->f_40 + (((SYSTEM::TO_FLOAT(iVar0) / uParam0->f_37) * SYSTEM::TIMESTEP()) * IntToFloat(iVar38))); } else { uParam0->f_40 = (uParam0->f_40 + ((SYSTEM::TO_FLOAT(iVar0) / uParam0->f_37) * SYSTEM::TIMESTEP())); } if (uParam0->f_40 > uParam0->f_38) { uParam0->f_40 = uParam0->f_38; } if (uParam0->f_40 < uParam0->f_39) { uParam0->f_40 = uParam0->f_39; } CAM::_0x487A82C650EB7799(1f); CAM::SET_CAM_FOV(uParam0->f_32, uParam0->f_40); fVar39 = ((uParam0->f_40 - 5f) / 42f); GRAPHICS::_0xE2892E7E55D7073A(fVar39); } } } } else if (uParam0->f_35 == 1 && uParam0->f_7 == 1) { Var40 = { uParam0->f_159 }; fVar41 = MISC::GET_DISTANCE_BETWEEN_COORDS(Var40, CAM::GET_CAM_COORD(uParam0->f_32), true); uParam0->f_45 = ((SYSTEM::COS(uParam0->f_42) * fVar41) * SYSTEM::SIN(-uParam0->f_42.f_2)); uParam0->f_45.f_1 = ((SYSTEM::COS(uParam0->f_42) * fVar41) * SYSTEM::COS(-uParam0->f_42.f_2)); uParam0->f_45.f_2 = (SYSTEM::SIN(uParam0->f_42) * fVar41); uParam0->f_45 = { uParam0->f_45 + CAM::GET_CAM_COORD(uParam0->f_32) }; CAM::POINT_CAM_AT_COORD(uParam0->f_32, uParam0->f_45); CAM::SET_CAM_FOV(uParam0->f_32, uParam0->f_40); } } else if (CAM::DOES_CAM_EXIST(uParam0->f_32)) { if (CAM::IS_CAM_ACTIVE(uParam0->f_32)) { CAM::SET_CAM_ACTIVE(uParam0->f_32, false); CAM::RENDER_SCRIPT_CAMS(false, false, 3000, true, false, 0); } } } Vector3 func_100(struct<3> Param0, float fParam1) { struct<3> Var0; float fVar1; float fVar2; fVar1 = SYSTEM::SIN(fParam1); fVar2 = SYSTEM::COS(fParam1); Var0.x = ((Param0.x * fVar2) - (Param0.f_1 * fVar1)); Var0.f_1 = ((Param0.x * fVar1) + (Param0.f_1 * fVar2)); Var0.f_2 = Param0.f_2; return Var0; } int func_101() { if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { return 1; } else if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { return 2; } else if (func_124(3)) { return 3; } return 0; } bool func_102(struct<3> Param0, struct<3> Param1, bool bParam2) { if (bParam2) { return (Param0.x == Param1.x && Param0.f_1 == Param1.f_1); } return ((Param0.x == Param1.x && Param0.f_1 == Param1.f_1) && Param0.f_2 == Param1.f_2); } float func_103(float fParam0, float fParam1, float fParam2) { while (fParam0 < fParam1) { fParam0 = (fParam0 + 360f); } while (fParam0 > fParam2) { fParam0 = (fParam0 - 360f); } return fParam0; } bool func_104(bool bParam0) { if (bParam0) { return (Global_22211.f_4 && Global_22211.f_104 == 4); } return Global_22211.f_4; } void func_105(var uParam0) { struct<3> Var0; struct<3> Var1; struct<3> Var2; float fVar3; float fVar4; float fVar5; int iVar6; int iVar7; struct<3> Var8; float fVar9; int iVar10; int iVar11; float fVar12; float fVar13; float fVar14; float fVar15; float fVar16; if (((CAM::DOES_CAM_EXIST(uParam0->f_32) && uParam0->f_7 == 0) && uParam0->f_35) && !uParam0->f_4) { iVar6 = 2; iVar6 = iVar6; Var0 = { CAM::GET_CAM_COORD(uParam0->f_32) }; Var1 = { CAM::GET_CAM_ROT(uParam0->f_32, 2) }; fVar9 = 0f; iVar10 = 0; iVar11 = 0; iVar11 = iVar11; fVar12 = Var0.f_2; fVar12 = fVar12; if (iVar10 == 0) { fVar13 = 0f; fVar14 = (SYSTEM::COS(Var1.x) * 50f); while (iVar6 < 21) { iVar6++; fVar5 = (fVar14 * IntToFloat(iVar6)); fVar3 = ((SYSTEM::SIN(Var1.f_2) * fVar5) * -1f); fVar4 = (SYSTEM::COS(Var1.f_2) * fVar5); fVar13 = PATHFIND::_GET_HEIGHTMAP_TOP_Z_FOR_AREA(((Var0.x + fVar3) - 3f), ((Var0.f_1 + fVar4) - 3f), ((Var0.x + fVar3) + 3f), ((Var0.f_1 + fVar4) + 3f)); fVar13 = (fVar13 - 20f); fVar12 = (Var0.f_2 + (SYSTEM::SIN(Var1.x) * (50f * IntToFloat(iVar6)))); if (fVar13 > fVar12) { if (iVar10 == 0) { iVar10 = 1; fVar9 = fVar13; iVar6 = 21; } } } } if (iVar10 == 0) { if (MISC::GET_GROUND_Z_FOR_3D_COORD(Var0, &fVar16, false, false)) { fVar15 = (Var0.f_2 - fVar16); if (fVar15 < 150f) { fVar15 = 150f; } } else { fVar15 = 150f; } if (Var1.x < 0f) { fVar5 = MISC::ABSF((fVar15 / MISC::TAN(Var1.x))); fVar9 = (Var0.f_2 - fVar15); } else { fVar5 = 1000f; fVar9 = (Var0.f_2 + (fVar5 * MISC::TAN(Var1.x))); } } fVar3 = ((SYSTEM::SIN(Var1.f_2) * fVar5) * -1f); fVar4 = (SYSTEM::COS(Var1.f_2) * fVar5); Var2 = { (fVar3 + Var0.x), (fVar4 + Var0.f_1), fVar9 }; iVar7 = 0; while (iVar7 < uParam0->f_175) { if (!PED::IS_PED_INJURED(uParam0->f_175[iVar7 /*10*/])) { if (func_106(ENTITY::GET_ENTITY_COORDS(uParam0->f_175[iVar7 /*10*/], true), 0.4f, 0.4f, 0.6f, 0.6f)) { iVar10 = 1; iVar11 = 1; Var2 = { ENTITY::GET_ENTITY_COORDS(uParam0->f_175[iVar7 /*10*/], true) }; fVar9 = Var8.f_2; } } iVar7++; } uParam0->f_159 = { Var2 }; } } int func_106(struct<3> Param0, float fParam1, float fParam2, float fParam3, float fParam4) { float fVar0; float fVar1; GRAPHICS::GET_SCREEN_COORD_FROM_WORLD_COORD(Param0, &fVar0, &fVar1); if (fVar0 >= fParam1 && fVar0 <= fParam3) { if (fVar1 >= fParam2 && fVar1 <= fParam4) { return 1; } } return 0; } void func_107() { if (bLocal_94) { if (PED::IS_PED_IN_VEHICLE(PLAYER::PLAYER_PED_ID(), iLocal_120, false)) { switch (iLocal_119) { case 0: if (func_181(&Local_71)) { if (AUDIO::START_AUDIO_SCENE("MP_HELI_CAM_FILTERING")) { iLocal_119++; } } break; case 1: AUDIO::SET_AUDIO_SCENE_VARIABLE("MP_HELI_CAM_FILTERING", "HeliFiltering", ENTITY::GET_ENTITY_SPEED(iLocal_120)); break; } } else if (iLocal_119 != 99 && iLocal_119 > 0) { AUDIO::STOP_AUDIO_SCENE("MP_HELI_CAM_FILTERING"); iLocal_119 = 99; } } } void func_108() { switch (iLocal_118) { case 0: if (!HUD::IS_HELP_MESSAGE_BEING_DISPLAYED() && !(HUD::HAS_THIS_ADDITIONAL_TEXT_LOADED("MC_PLAY", 0) && func_41("SUBJOB_HELP_7"))) { if (bLocal_84) { if (iLocal_78 == joaat("buzzard") || iLocal_78 == joaat("savage")) { func_48("HUNTGUN_2", -1); } else if (iLocal_78 == joaat("valkyrie")) { func_48("HUNTGUN_2c", -1); } else if (iLocal_78 == joaat("hunter")) { func_48("HUNTGUN_2c", -1); } else if (func_191(iLocal_120)) { func_48(func_9(iLocal_120), -1); } else if (Global_1319110 != -1 || Global_1319116 != -1) { func_48(func_9(iLocal_120), -1); } else { func_48("HUNTGUN_2b", -1); } } else if (bLocal_85) { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("bombushka")) { func_48("BOMBGUN_T_2b", -1); } if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula")) { func_48("AKULAGUN_P1", -1); } if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol")) { func_48("VOLGUN_T_2b", -1); } } else if (bLocal_86) { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("bombushka")) { func_48("BOMBGUN_T_2d", -1); } if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula")) { func_48("AKULAGUN_P1", -1); } if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol")) { func_48("VOLGUN_T_2c", -1); } } else if (!func_191(iLocal_120)) { if (iLocal_78 == joaat("buzzard") || iLocal_78 == joaat("savage")) { func_48("HUNTGUN_4", -1); } else if (iLocal_78 == joaat("valkyrie") || iLocal_78 == joaat("hunter")) { func_48("HUNTGUN_4c", -1); } else if (func_124(3)) { func_48("IAAGUN_1", -1); } else { func_48("HUNTGUN_4b", -1); } } iLocal_118++; } break; case 1: if ((((func_41("HUNTGUN_2") || func_41("HUNTGUN_4")) || func_41("HUNTGUN_2b")) || func_41("HUNTGUN_4b")) && Global_1319116 == -1) { iLocal_118++; } if (Global_1319110 != -1 || Global_1319116 != -1) { if (func_43(Global_1590374) && !MISC::IS_BIT_SET(Global_4456448.f_25, 7)) { func_48(func_9(iLocal_120), -1); } else if (func_111()) { func_48(func_9(iLocal_120), -1); if (!func_122(&uLocal_75)) { func_144(&uLocal_75, 0, 0); } } else if (func_41(func_9(iLocal_120))) { HUD::CLEAR_HELP(true); } } break; case 2: if (!HUD::IS_HELP_MESSAGE_BEING_DISPLAYED()) { if (bLocal_84) { if (func_110(PLAYER::PLAYER_ID(), 19)) { if (!func_109()) { if (PAD::_IS_USING_KEYBOARD(0)) { func_48("HUNTGUN_6_KM", -1); } else { func_48("HUNTGUN_6", -1); } } } } iLocal_118++; } break; } } bool func_109() { return MISC::IS_BIT_SET(Global_2537071.f_1734, 11); } bool func_110(int iParam0, int iParam1) { return MISC::IS_BIT_SET(Global_2425662[iParam0 /*421*/].f_208, iParam1); } bool func_111() { if ((func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) || func_124(3)) { return 1; } return !func_121(&uLocal_75, 7500, 0); } int func_112() { if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { if (Global_1319110 != -1) { return 1; } } if (((func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) || func_75(PLAYER::PLAYER_ID())) || func_124(3)) { if (Global_1319116 != -1) { return 1; } } return 0; } int func_113(int iParam0) { switch (ENTITY::GET_ENTITY_MODEL(iParam0)) { case joaat("trailerlarge"): case joaat("buzzard"): case joaat("savage"): return 1; break; } return 0; } void func_114(int iParam0) { if (func_119()) { return; } if (!Global_19486.f_1 == 1) { if (func_44(0)) { func_115(iParam0); } MISC::SET_BIT(&Global_7357, 2); } } void func_115(int iParam0) { if (func_119()) { return; } if (Global_19664) { if (func_118()) { func_117(1, 1); } else { func_117(0, 0); } } if (Global_19486.f_1 == 10 || Global_19486.f_1 == 9) { MISC::SET_BIT(&Global_7357, 16); } if (AUDIO::IS_MOBILE_PHONE_CALL_ONGOING()) { AUDIO::STOP_SCRIPTED_CONVERSATION(false); } Global_20805 = 5; if (iParam0 == 1) { MISC::SET_BIT(&Global_7356, 30); } else { MISC::CLEAR_BIT(&Global_7356, 30); } if (!func_116()) { Global_19486.f_1 = 3; } } int func_116() { if (Global_19486.f_1 == 1 || Global_19486.f_1 == 0) { return 1; } return 0; } void func_117(bool bParam0, bool bParam1) { if (bParam0) { if (func_44(0)) { Global_19664 = 1; if (bParam1) { MOBILE::GET_MOBILE_PHONE_POSITION(&Global_19423); } Global_19414 = { Global_19432[Global_19431 /*3*/] }; MOBILE::SET_MOBILE_PHONE_POSITION(Global_19414); } } else if (Global_19664 == 1) { Global_19664 = 0; Global_19414 = { Global_19439[Global_19431 /*3*/] }; if (bParam1) { MOBILE::SET_MOBILE_PHONE_POSITION(Global_19423); } else { MOBILE::SET_MOBILE_PHONE_POSITION(Global_19414); } } } bool func_118() { return MISC::IS_BIT_SET(Global_1687687, 5); } bool func_119() { return MISC::IS_BIT_SET(Global_1687687, 19); } bool func_120() { return HUD::GET_PAUSE_MENU_STATE() != 0; } int func_121(var uParam0, int iParam1, bool bParam2) { if (iParam1 == -1) { return 1; } func_144(uParam0, bParam2, 0); if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS() && !bParam2) { if (MISC::ABSI(NETWORK::GET_TIME_DIFFERENCE(NETWORK::GET_NETWORK_TIME(), *uParam0)) >= iParam1) { return 1; } } else if (MISC::ABSI(NETWORK::GET_TIME_DIFFERENCE(MISC::GET_GAME_TIMER(), *uParam0)) >= iParam1) { return 1; } return 0; } bool func_122(var uParam0) { return uParam0->f_1; } int func_123(int iParam0) { if (ENTITY::DOES_ENTITY_EXIST(iParam0)) { if (!ENTITY::IS_ENTITY_DEAD(iParam0, false)) { return 1; } } return 0; } bool func_124(int iParam0) { return Global_262145.f_5008[iParam0] == Global_4456448.f_194990; } int func_125() { if ((((func_141(PLAYER::PLAYER_ID()) || func_193(PLAYER::PLAYER_ID())) || func_140(PLAYER::PLAYER_ID())) || func_75(PLAYER::PLAYER_ID())) || func_124(3)) { return 1; } return 0; } void func_126(var uParam0, int iParam1) { uParam0->f_51 = iParam1; } void func_127() { if (MISC::IS_PC_VERSION()) { if (bLocal_132 == 0) { PAD::_SWITCH_TO_INPUT_MAPPING_SCHEME("Turret"); bLocal_132 = true; } } } void func_128() { iLocal_115 = 0; if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { iLocal_115 = 1; } else if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { iLocal_115 = 2; } else if (func_124(3)) { iLocal_115 = 3; } else if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("buzzard") || ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("savage")) { iLocal_115 = 4; } } void func_129() { if (ENTITY::DOES_ENTITY_EXIST(Local_71.f_9)) { if ((!ENTITY::IS_ENTITY_DEAD(Local_71.f_9, false) && !(!ENTITY::IS_ENTITY_DEAD(Global_1370234, false) && ENTITY::GET_ENTITY_MODEL(Local_71.f_9) == ENTITY::GET_ENTITY_MODEL(Global_1370234))) && !func_191(iLocal_120)) { if ((((ENTITY::GET_ENTITY_MODEL(Local_71.f_9) != joaat("valkyrie") && ENTITY::GET_ENTITY_MODEL(Local_71.f_9) != joaat("savage")) && ENTITY::GET_ENTITY_MODEL(Local_71.f_9) != joaat("hunter")) && !func_141(PLAYER::PLAYER_ID())) && !func_140(PLAYER::PLAYER_ID())) { NETWORK::SET_ENTITY_LOCALLY_INVISIBLE(Local_71.f_9); if (!bLocal_90) { NETWORK::SET_PLAYER_INVISIBLE_LOCALLY(iLocal_124, false); } if (!bLocal_92) { NETWORK::SET_PLAYER_INVISIBLE_LOCALLY(iLocal_125, false); } } } } } void func_130() { struct<3> Var0; float fVar1; if (bLocal_91) { if (!bLocal_92 && iLocal_125 != -1) { Var0 = { CAM::GET_FINAL_RENDERED_IN_WHEN_FRIENDLY_ROT(iLocal_125, 2) }; fVar1 = CAM::GET_FINAL_RENDERED_IN_WHEN_FRIENDLY_FOV(iLocal_125); switch (iLocal_134) { case 0: if (CAM::DOES_CAM_EXIST(Local_71.f_32)) { Local_71.f_42 = { Var0 }; Local_71.f_40 = fVar1; CAM::SET_CAM_ROT(Local_71.f_32, Local_71.f_42, 2); CAM::SET_CAM_FOV(Local_71.f_32, Local_71.f_40); iLocal_134++; } break; case 1: Var0 = { func_132(Var0, Local_71.f_42) }; fVar1 = func_131(fVar1, Local_71.f_40); if (CAM::DOES_CAM_EXIST(Local_71.f_32)) { Local_71.f_42 = { Var0 }; Local_71.f_40 = fVar1; CAM::SET_CAM_ROT(Local_71.f_32, Local_71.f_42, 2); CAM::SET_CAM_FOV(Local_71.f_32, Local_71.f_40); } break; } } } } float func_131(float fParam0, float fParam1) { float fVar0; fVar0 = (fParam1 + ((fParam0 - fParam1) * Local_116.x)); if (MISC::ABSF((fVar0 - fParam0)) < fLocal_117) { fVar0 = fParam0; } return fVar0; } Vector3 func_132(struct<3> Param0, struct<3> Param1) { struct<3> Var0; float fVar1; fVar1 = (Param0.f_2 - Param1.f_2); if (MISC::ABSF(fVar1) > 180f) { if (fVar1 > 0f) { fVar1 = (fVar1 - 360f); } else { fVar1 = (fVar1 + 360f); } Param1.f_2 = (Param0.f_2 - fVar1); } Var0 = { Param1 + Param0 - Param1 * Local_116 }; if (MISC::ABSF((Var0.x - Param0.x)) < fLocal_117) { Var0 = { Param0 }; } if (MISC::ABSF((Var0.f_1 - Param0.f_1)) < fLocal_117) { Var0 = { Param0 }; } if (MISC::ABSF((Var0.f_2 - Param0.f_2)) < fLocal_117) { Var0 = { Param0 }; } return Var0; } void func_133() { struct<3> Var0; struct<3> Var1; struct<3> Var2; if (((bLocal_94 || Global_1319110 != -1) || Global_1319116 != -1) || func_191(iLocal_120)) { if (Global_1319110 != -1) { switch (Global_1319110) { case 1: Var1 = { 0f, 50f, 1f }; break; case 2: Var1 = { 0f, -50f, 1f }; break; case 3: Var1 = { 0f, -50f, 1f }; break; } Var0 = { ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iLocal_120, Var1) }; } else if (Global_1319116 != -1) { switch (Global_1319110) { case 1: Var2 = { 0f, 50f, 1f }; break; case 2: Var2 = { 0f, -50f, 1f }; break; case 3: Var2 = { 0f, -50f, 1f }; break; } Var0 = { ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iLocal_120, Var2) }; } else { Var0 = { ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(iLocal_120, 0f, 20f, -1f) }; } func_83(&Local_71, 0, 1086324736, -1030356992, -1020002304, 1127481344, 1041865114); func_99(&Local_71, 1086324736, -1030356992, -1020002304, 1127481344, 1041865114); func_134(&Local_71, Var0); CAM::_0x661B5C8654ADD825(Local_71.f_32, true); if ((Global_1319110 != -1 || func_191(iLocal_120)) || Global_1319116 != -1) { return; } Local_71.f_42 = { ENTITY::GET_ENTITY_ROTATION(iLocal_120, 2) - Vector(0f, 0f, 3f) }; } } void func_134(var uParam0, struct<3> Param1) { if ((!func_191(uParam0->f_8) && !func_125()) || Global_1319110 != -1) { uParam0->f_45 = { Param1 }; CAM::POINT_CAM_AT_COORD(uParam0->f_32, uParam0->f_45); uParam0->f_159 = { Param1 }; } } int func_135(var uParam0, int iParam1, int iParam2, int iParam3, int iParam4) { struct<3> Var0; struct<3> Var1; int iVar2; float fVar3; if (iParam2 == 1 && uParam0->f_1 == 0) { if (uParam0->f_5 == 0) { if (Global_1319110 != -1) { iLocal_69 = unk_0x67D02A194A2FC2BD(func_143()); } else { iLocal_69 = unk_0x67D02A194A2FC2BD(func_143()); } } GRAPHICS::REQUEST_STREAMED_TEXTURE_DICT("helicopterhud", false); if (!CAM::DOES_CAM_EXIST(uParam0->f_32)) { uParam0->f_35 = 0; uParam0->f_32 = CAM::CREATE_CAM("default_scripted_camera", false); if (func_191(iParam3) || func_125()) { uParam0->f_12 = 0.1f; } CAM::SET_CAM_NEAR_CLIP(uParam0->f_32, uParam0->f_12); } MISC::SET_INSTANCE_PRIORITY_HINT(4); func_136(1, 1, 1, 0); if (!ENTITY::IS_ENTITY_DEAD(iParam1, false)) { if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { if (ENTITY::IS_ENTITY_A_VEHICLE(iParam1)) { uParam0->f_8 = ENTITY::GET_VEHICLE_INDEX_FROM_ENTITY_INDEX(iParam1); VEHICLE::SET_LIGHTS_CUTOFF_DISTANCE_TWEAK(300f); } VEHICLE::SET_LIGHTS_CUTOFF_DISTANCE_TWEAK(300f); uParam0->f_6 = 1; uParam0->f_33 = 1; uParam0->f_50 = 1; uParam0->f_2 = 1; uParam0->f_9 = iParam1; Var0 = { ENTITY::GET_ENTITY_COORDS(iParam1, true) }; uParam0->f_22 = Var0.f_2; Var1 = { ENTITY::GET_ENTITY_ROTATION(iParam1, 2) }; uParam0->f_41 = Var1.f_2; if (uParam0->f_4) { PAD::DISABLE_ALL_CONTROL_ACTIONS(0); } else { PAD::DISABLE_ALL_CONTROL_ACTIONS(0); PLAYER::SET_EVERYONE_IGNORE_PLAYER(PLAYER::PLAYER_ID(), true); } GRAPHICS::PUSH_TIMECYCLE_MODIFIER(); if (VEHICLE::IS_VEHICLE_DRIVEABLE(uParam0->f_8, false)) { iVar2 = ENTITY::GET_ENTITY_MODEL(uParam0->f_8); } if (iVar2 == joaat("buzzard") || iVar2 == joaat("savage")) { GRAPHICS::SET_TIMECYCLE_MODIFIER("heliGunCam"); } else if (iVar2 == joaat("valkyrie") || iVar2 == joaat("hunter")) { GRAPHICS::SET_TIMECYCLE_MODIFIER("heliGunCam"); } else if (Global_1319110 != -1) { } else { GRAPHICS::SET_TIMECYCLE_MODIFIER("eyeinthesky"); } GRAPHICS::_0x6DDBF9DFFC4AC080(true); MISC::GET_GROUND_Z_FOR_3D_COORD(Var0, &fVar3, false, false); uParam0->f_199 = (fVar3 * 10f); if (uParam0->f_200 == 1) { if (uParam0->f_205 != -1) { if (Global_1319110 == -1) { if (AUDIO::HAS_SOUND_FINISHED(uParam0->f_205)) { AUDIO::PLAY_SOUND_FRONTEND(uParam0->f_205, "COP_HELI_CAM_BACKGROUND", 0, true); } } } } func_97(uParam0); uParam0->f_1 = 1; } } return 0; } else { if (uParam0->f_1 == 1 && iParam2 == 1) { if (uParam0->f_86 == 0) { func_85(uParam0, 0, -1020002304, 1127481344); func_84(); } else { return 1; } } if (uParam0->f_1 == 1 && iParam2 == 0) { if (iParam4 == 0) { uParam0->f_48 = 0; } uParam0->f_6 = 0; uParam0->f_33 = 0; uParam0->f_50 = 0; uParam0->f_9 = 0; uParam0->f_2 = 0; uParam0->f_55 = 0; if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { PAD::ENABLE_ALL_CONTROL_ACTIONS(0); PLAYER::SET_EVERYONE_IGNORE_PLAYER(PLAYER::PLAYER_ID(), false); } if (VEHICLE::IS_VEHICLE_DRIVEABLE(uParam0->f_8, false)) { if (ENTITY::IS_ENTITY_ATTACHED_TO_ANY_OBJECT(uParam0->f_8)) { ENTITY::DETACH_ENTITY(uParam0->f_8, true, true); } if (!uParam0->f_4) { ENTITY::FREEZE_ENTITY_POSITION(uParam0->f_8, false); ENTITY::SET_ENTITY_INVINCIBLE(uParam0->f_8, false); ENTITY::SET_ENTITY_HAS_GRAVITY(uParam0->f_8, true); VEHICLE::SET_VEHICLE_GRAVITY(uParam0->f_8, true); } } MISC::SET_INSTANCE_PRIORITY_HINT(0); if (CAM::DOES_CAM_EXIST(uParam0->f_32)) { if (CAM::IS_CAM_ACTIVE(uParam0->f_32)) { CAM::SET_CAM_ACTIVE(uParam0->f_32, false); } if (CAM::IS_CAM_RENDERING(uParam0->f_32)) { CAM::RENDER_SCRIPT_CAMS(false, false, 3000, true, false, 0); } CAM::DESTROY_CAM(uParam0->f_32, false); } if (uParam0->f_202 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_202)) { AUDIO::STOP_SOUND(uParam0->f_202); } } if (uParam0->f_203 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_203)) { AUDIO::STOP_SOUND(uParam0->f_203); } } if (uParam0->f_204 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_204)) { AUDIO::STOP_SOUND(uParam0->f_204); } } if (uParam0->f_206 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_206)) { AUDIO::STOP_SOUND(uParam0->f_206); } } if (uParam0->f_207 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_207)) { AUDIO::STOP_SOUND(uParam0->f_207); } } if (uParam0->f_208 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_208)) { AUDIO::STOP_SOUND(uParam0->f_208); } } if (uParam0->f_205 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_205)) { AUDIO::STOP_SOUND(uParam0->f_205); } } if (uParam0->f_209 != -1) { if (!AUDIO::HAS_SOUND_FINISHED(uParam0->f_209)) { AUDIO::STOP_SOUND(uParam0->f_209); } } if (uParam0->f_200 == 1) { AUDIO::RELEASE_AMBIENT_AUDIO_BANK(); AUDIO::RELEASE_SOUND_ID(uParam0->f_205); AUDIO::RELEASE_SOUND_ID(uParam0->f_202); AUDIO::RELEASE_SOUND_ID(uParam0->f_203); AUDIO::RELEASE_SOUND_ID(uParam0->f_204); AUDIO::RELEASE_SOUND_ID(uParam0->f_206); AUDIO::RELEASE_SOUND_ID(uParam0->f_207); AUDIO::RELEASE_SOUND_ID(uParam0->f_208); AUDIO::RELEASE_SOUND_ID(uParam0->f_209); uParam0->f_205 = -1; uParam0->f_202 = -1; uParam0->f_203 = -1; uParam0->f_204 = -1; uParam0->f_206 = -1; uParam0->f_207 = -1; uParam0->f_208 = -1; uParam0->f_209 = -1; uParam0->f_200 = 0; } GRAPHICS::CLEAR_TIMECYCLE_MODIFIER(); GRAPHICS::_0x6DDBF9DFFC4AC080(false); GRAPHICS::SET_STREAMED_TEXTURE_DICT_AS_NO_LONGER_NEEDED("helicopterHUD"); GRAPHICS::SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED(&iLocal_69); GRAPHICS::POP_TIMECYCLE_MODIFIER(); func_136(0, 0, 1, 0); uParam0->f_8 = 0; uParam0->f_1 = 0; func_97(uParam0); return 1; } } return 0; } int func_136(bool bParam0, bool bParam1, int iParam2, bool bParam3) { int iVar0; iVar0 = 0; if (MISC::IS_PC_VERSION()) { if (CUTSCENE::_0xA0FE76168A189DDB() != bParam0 && iParam2) { CUTSCENE::_0x20746F7B1032A3C7(bParam0, bParam1, true, bParam3); iVar0 = 1; } } return iVar0; } int func_137(int iParam0) { return iParam0; } int func_138(var uParam0, int iParam1) { uParam0->f_5 = iParam1; uParam0->f_62 = 93; uParam0->f_62.f_1 = 182; uParam0->f_62.f_2 = 229; uParam0->f_65 = 255; uParam0->f_65.f_1 = 0; uParam0->f_65.f_2 = 0; uParam0->f_68 = 255; uParam0->f_68.f_1 = 255; uParam0->f_68.f_2 = 255; uParam0->f_71 = 255; uParam0->f_71.f_1 = 40; uParam0->f_71.f_2 = 0; uParam0->f_15 = 40f; uParam0->f_36 = 0.0075f; uParam0->f_37 = 20f; uParam0->f_40 = 28f; if (func_140(PLAYER::PLAYER_ID()) || func_141(PLAYER::PLAYER_ID())) { uParam0->f_40 = 40f; } uParam0->f_54 = 0.234f; uParam0->f_58 = 22; uParam0->f_59 = 201; uParam0->f_60 = 39; uParam0->f_61 = 181; uParam0->f_74 = 0.044f; uParam0->f_75 = 0.02f; uParam0->f_77 = 1240f; uParam0->f_78 = 5000f; uParam0->f_79 = 1000f; uParam0->f_81 = 0.829f; uParam0->f_82 = 0.096f; uParam0->f_83 = 0.865f; uParam0->f_84 = 0.567f; uParam0->f_85 = 0.087f; uParam0->f_18 = 140f; uParam0->f_19 = 1f; uParam0->f_20 = 3f; uParam0->f_21 = 1f; uParam0->f_88 = 0.052f; uParam0->f_89 = 0.75f; uParam0->f_90 = 0.86f; uParam0->f_91 = 0.02f; uParam0->f_195 = 0.65f; uParam0->f_196 = 0.024f; uParam0->f_157 = 0.12f; if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { HUD::REQUEST_ADDITIONAL_TEXT("CHOPPER", 5); if (HUD::HAS_THIS_ADDITIONAL_TEXT_LOADED("CHOPPER", 5)) { return 1; } } else { HUD::REQUEST_ADDITIONAL_TEXT("CHOPPER", 3); if (HUD::HAS_THIS_ADDITIONAL_TEXT_LOADED("CHOPPER", 3)) { return 1; } } return 0; } void func_139() { MISC::SET_BIT(&Global_7357, 4); } int func_140(int iParam0) { if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { if (Global_2425662[iParam0 /*421*/].f_310.f_5 != -1) { return func_37(Global_2425662[iParam0 /*421*/].f_310.f_5) == 10; } } } return 0; } int func_141(int iParam0) { if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { if (Global_2425662[iParam0 /*421*/].f_310.f_5 != -1 && Global_2425662[iParam0 /*421*/].f_310.f_8 != func_17()) { return func_37(Global_2425662[iParam0 /*421*/].f_310.f_5) == 8; } } } return 0; } int func_142(int iParam0) { if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { if (Global_2425662[iParam0 /*421*/].f_310.f_5 != -1) { return func_37(Global_2425662[iParam0 /*421*/].f_310.f_5) == 6; } } } return 0; } char* func_143() { if ((((func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) || func_193(PLAYER::PLAYER_ID())) || func_142(PLAYER::PLAYER_ID())) || Global_1319116 != -1) { return "turret_cam"; } return "heli_cam"; } void func_144(var uParam0, bool bParam1, bool bParam2) { if (uParam0->f_1 == 0) { if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS() && !bParam1) { if (!bParam2) { *uParam0 = NETWORK::GET_NETWORK_TIME(); } else { *uParam0 = NETWORK::GET_NETWORK_TIME_ACCURATE(); } } else { *uParam0 = MISC::GET_GAME_TIMER(); } uParam0->f_1 = 1; } } void func_145(int iParam0) { int iVar0; if (ENTITY::DOES_ENTITY_EXIST(iLocal_120) && !ENTITY::IS_ENTITY_DEAD(iLocal_120, false)) { iVar0 = ENTITY::GET_ENTITY_MODEL(iLocal_120); switch (iVar0) { case joaat("avenger"): VEHICLE::_0xC60060EB0D8AC7B1(iLocal_120, 0, iParam0); VEHICLE::_0xC60060EB0D8AC7B1(iLocal_120, 1, iParam0); VEHICLE::_0xC60060EB0D8AC7B1(iLocal_120, 2, iParam0); break; } } } void func_146() { if (func_41("HUNTGUN_1")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_1b")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_1c")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_3")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_3b")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUN_3c")) { HUD::CLEAR_HELP(true); } if (((((((((((((((((((((func_41("BOMBGUN_1c") || func_41("BOMBGUN_1c1")) || func_41("BOMBGUN_1c2")) || func_41("BOMBGUN_2c")) || func_41("BOMBGUN_2c1")) || func_41("BOMBGUN_2c2")) || func_41("BOMBGUN_3c")) || func_41("BOMBGUN_3c1")) || func_41("BOMBGUN_3c2")) || func_41("BOMBGUN_FULL")) || func_41("BOMBGUN_BUSY")) || func_41("AKULAGUN_2")) || func_41("AKULAGUN_1")) || func_41("VOLGUN_1c")) || func_41("VOLGUN_1c1")) || func_41("VOLGUN_1c2")) || func_41("VOLGUN_2c")) || func_41("VOLGUN_2c1")) || func_41("VOLGUN_2c2")) || func_41("VOLGUN_3c")) || func_41("VOLGUN_3c1")) || func_41("VOLGUN_3c2")) { HUD::CLEAR_HELP(true); } if (func_41("HUNTGUNH_1c")) { HUD::CLEAR_HELP(true); } if (func_41(func_9(iLocal_120))) { HUD::CLEAR_HELP(true); } } void func_147(var uParam0) { uParam0->f_1 = 0; } int func_148(int iParam0) { if (ENTITY::GET_ENTITY_MODEL(iParam0) == joaat("akula")) { return 1; } switch (ENTITY::GET_ENTITY_MODEL(ENTITY::GET_VEHICLE_INDEX_FROM_ENTITY_INDEX(iParam0))) { case joaat("valkyrie"): case joaat("bombushka"): case joaat("volatol"): case joaat("hunter"): case joaat("savage"): return 1; break; } return 0; } void func_149(int iParam0) { if (NETWORK::PARTICIPANT_ID_TO_INT() != -1) { Local_131[NETWORK::PARTICIPANT_ID_TO_INT() /*2*/].f_1 = iParam0; } } int func_150() { bool bVar0; int iVar1; int iVar2; int iVar3; if (((!bLocal_84 && !bLocal_85) && !bLocal_86) && func_191(iLocal_120)) { return 0; } if (func_157()) { return 0; } if (func_156(PLAYER::PLAYER_ID())) { return 0; } if (func_75(PLAYER::PLAYER_ID()) || func_27()) { return 0; } if (Global_1316759) { return 0; } iVar1 = TASK::GET_SCRIPT_TASK_STATUS(PLAYER::PLAYER_PED_ID(), 355471868); if ((iVar1 == 1 || iVar1 == 0) || PED::GET_PED_RESET_FLAG(PLAYER::PLAYER_PED_ID(), 373)) { return 0; } if (func_41("TUR_GR") || func_41("TUR_WATER")) { return 0; } if ((((!HUD::IS_PAUSE_MENU_ACTIVE() && !func_45()) && !func_44(0)) && !Global_1312791) && !Global_1315732) { if (func_155()) { if (PAD::IS_CONTROL_JUST_PRESSED(0, 51) && iLocal_88 < 1) { func_146(); func_48("BOMBGUN_BUSY", -1); iLocal_88++; } } else { iVar2 = 51; iVar3 = 0; if (Global_1319110 != -1 || Global_1319116 != -1) { iVar3 = 2; iVar2 = 176; } if (Global_1319110 != -1) { if (!ENTITY::DOES_ENTITY_EXIST(iLocal_120)) { if (ENTITY::DOES_ENTITY_EXIST(Global_1370236)) { iLocal_120 = Global_1370236; } } } if (ENTITY::DOES_ENTITY_EXIST(iLocal_120)) { if (!ENTITY::IS_ENTITY_DEAD(iLocal_120, false)) { if (!VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, -1, false)) { iLocal_122 = VEHICLE::GET_PED_IN_VEHICLE_SEAT(iLocal_120, -1, 0); } } } if (PAD::IS_CONTROL_JUST_PRESSED(iVar3, iVar2)) { func_144(&uLocal_105, 1, 0); } if (PAD::IS_CONTROL_JUST_RELEASED(iVar3, iVar2)) { if (func_122(&uLocal_105)) { if (func_121(&uLocal_105, 500, 1)) { if (iLocal_110 == 0) { func_147(&uLocal_105); iLocal_110 = 1; } } else if (iLocal_109 == 0) { if (func_154()) { func_147(&uLocal_105); iLocal_109 = 1; } else { func_147(&uLocal_105); } } } } else if (iLocal_110 == 0) { if (func_122(&uLocal_105)) { if (func_121(&uLocal_105, 500, 1)) { func_147(&uLocal_105); iLocal_110 = 1; } } } if (!func_157()) { if (((((PAD::IS_CONTROL_JUST_RELEASED(iVar3, iVar2) && !(iLocal_122 == PLAYER::PLAYER_PED_ID() && iLocal_78 == joaat("hunter"))) && !func_191(iLocal_120)) || (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(iVar3, iVar2) && Global_1319110 != -1)) || (PAD::IS_DISABLED_CONTROL_JUST_PRESSED(iVar3, iVar2) && Global_1319116 != -1)) || iLocal_109) { iLocal_109 = 0; if (func_151()) { if (!MISC::IS_BIT_SET(Global_4456448.f_15, 12) && !Global_2460715) { if (VEHICLE::IS_VEHICLE_DRIVEABLE(iLocal_120, false) && !func_42(iLocal_120, 0)) { bVar0 = true; Global_2513487 = 1; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_847 = 1; } else { if (!VEHICLE::IS_VEHICLE_DRIVEABLE(iLocal_120, false) && ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("avenger")) { bVar0 = true; Global_2513487 = 1; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_847 = 1; } if (!VEHICLE::IS_VEHICLE_DRIVEABLE(iLocal_120, false) && ENTITY::GET_ENTITY_MODEL(iLocal_120) != joaat("avenger")) { } } } else { return 0; } } } } } } if ((func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) || func_125()) { return bVar0; } if ((bLocal_84 || bLocal_85) || bLocal_86) { if (bVar0) { } return bVar0; } else if (func_179()) { if (bVar0) { if (iLocal_78 != joaat("hunter")) { return bVar0; } else { return 0; } } } return 0; } int func_151() { if (Global_1319110 != -1 || Global_1319116 != -1) { if ((((ENTITY::IS_ENTITY_PLAYING_ANIM(PLAYER::PLAYER_PED_ID(), "ANIM@AMB@FACILITY@LAUNCH_CONTROLS@", "enter", 3) || ENTITY::IS_ENTITY_PLAYING_ANIM(PLAYER::PLAYER_PED_ID(), "ANIM@AMB@FACILITY@LAUNCH_CONTROLS@", "enter_left", 3)) || ENTITY::IS_ENTITY_PLAYING_ANIM(PLAYER::PLAYER_PED_ID(), "ANIM@AMB@FACILITY@LAUNCH_CONTROLS@", "exit", 3)) || ENTITY::IS_ENTITY_PLAYING_ANIM(PLAYER::PLAYER_PED_ID(), "ANIM@AMB@FACILITY@LAUNCH_CONTROLS@", "exit_left", 3)) || func_152(PLAYER::PLAYER_PED_ID(), 2106541073)) { return 0; } if ((!ENTITY::IS_ENTITY_PLAYING_ANIM(PLAYER::PLAYER_PED_ID(), "ANIM@AMB@FACILITY@LAUNCH_CONTROLS@", "base", 3) && !ENTITY::IS_ENTITY_PLAYING_ANIM(PLAYER::PLAYER_PED_ID(), "ANIM@AMB@FACILITY@LAUNCH_CONTROLS@", "computer_enter", 3)) && !ENTITY::IS_ENTITY_PLAYING_ANIM(PLAYER::PLAYER_PED_ID(), "ANIM@AMB@FACILITY@LAUNCH_CONTROLS@", "computer_exit", 3)) { return 0; } if (func_27()) { return 0; } } if (func_124(3)) { if (Global_1573352 == 185) { if (Global_1574442 != 0) { return 0; } } } return 1; } int func_152(int iParam0, int iParam1) { if (func_153(iParam0)) { if (TASK::GET_SCRIPT_TASK_STATUS(iParam0, iParam1) == 1 || TASK::GET_SCRIPT_TASK_STATUS(iParam0, iParam1) == 0) { return 1; } } return 0; } int func_153(int iParam0) { if (func_123(iParam0)) { if (!PED::IS_PED_INJURED(iParam0)) { return 1; } } return 0; } int func_154() { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol") && bLocal_84) { return 0; } return 1; } int func_155() { if (func_191(iLocal_120)) { return iLocal_112; } return 0; } int func_156(int iParam0) { if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { if (Global_2425662[iParam0 /*421*/].f_310.f_5 != -1) { return func_37(Global_2425662[iParam0 /*421*/].f_310.f_5) == 7; } } } return 0; } int func_157() { if (!func_160(PLAYER::PLAYER_ID())) { if (func_41("BHH_LEFTRANGE")) { return 1; } if (func_158(PLAYER::PLAYER_ID()) == 239) { return 1; } } return 0; } int func_158(int iParam0) { if (func_159(iParam0, 0)) { return Global_1628237[iParam0 /*615*/].f_11.f_33; } return -1; } int func_159(int iParam0, int iParam1) { if (Global_1628237[iParam0 /*615*/].f_11.f_33 != -1 || (iParam1 && Global_1628237[iParam0 /*615*/].f_11.f_32 != -1)) { return 1; } return 0; } int func_160(int iParam0) { if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { return Global_2425662[iParam0 /*421*/].f_310.f_5 != -1; } else if ((Global_1312877 && iParam0 == PLAYER::PLAYER_ID()) && func_15(iParam0, 1, 0)) { return Global_2425662[iParam0 /*421*/].f_310.f_5 != -1; } } return 0; } void func_161() { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("volatol")) { func_163(); } else { func_162(); } } void func_162() { if (!func_191(iLocal_120) || ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula")) { iLocal_110 = 0; return; } if (iLocal_110) { func_146(); iLocal_110 = 0; if (bLocal_84) { if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 1, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 0); iLocal_111 = 1; } else if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 2, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 1); iLocal_111 = 2; } else if (iLocal_87 < 1) { func_48("BOMBGUN_FULL", -1); iLocal_87++; } } else if (bLocal_85) { if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 2, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 0); iLocal_111 = 2; } else if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 0, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 1); iLocal_111 = 0; } else if (iLocal_87 < 1) { func_48("BOMBGUN_FULL", -1); iLocal_87++; } } else if (bLocal_86) { if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 0, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 0); iLocal_111 = 0; } else if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 1, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 1); iLocal_111 = 1; } else if (iLocal_87 < 1) { func_48("BOMBGUN_FULL", -1); iLocal_87++; } } } if (iLocal_111 != -2) { if (VEHICLE::GET_PED_IN_VEHICLE_SEAT(iLocal_120, iLocal_111, 0) == PLAYER::PLAYER_PED_ID()) { iLocal_112 = 0; iLocal_111 = -2; iLocal_80 = 0; } else { iLocal_112 = 1; if (!VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, iLocal_111, false)) { switch (iLocal_111) { case 0: func_48("BOMBGUN_1o", 1000); break; case 1: func_48("BOMBGUN_2o", 1000); break; case 2: func_48("BOMBGUN_3o", 1000); break; } iLocal_112 = 0; iLocal_111 = -2; iLocal_80 = 0; } } } } void func_163() { if (!func_191(iLocal_120)) { iLocal_110 = 0; return; } if (iLocal_110) { func_146(); iLocal_110 = 0; if (bLocal_85) { if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 2, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 0); iLocal_111 = 2; } else if (iLocal_87 < 1) { func_48("BOMBGUN_FULL", -1); iLocal_87++; } } else if (bLocal_86) { if (VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 1, false)) { TASK::TASK_SHUFFLE_TO_NEXT_VEHICLE_SEAT(PLAYER::PLAYER_PED_ID(), iLocal_120, 1); iLocal_111 = 1; } else if (iLocal_87 < 1) { func_48("BOMBGUN_FULL", -1); iLocal_87++; } } } if (iLocal_111 != -2) { if (VEHICLE::GET_PED_IN_VEHICLE_SEAT(iLocal_120, iLocal_111, 0) == PLAYER::PLAYER_PED_ID()) { iLocal_112 = 0; iLocal_111 = -2; iLocal_80 = 0; } else { iLocal_112 = 1; if (!VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, iLocal_111, false)) { switch (iLocal_111) { case 1: func_48("BOMBGUN_2o", 1000); break; case 2: func_48("BOMBGUN_1o", 1000); break; } iLocal_112 = 0; iLocal_111 = -2; iLocal_80 = 0; } } } } void func_164() { bool bVar0; if (!func_170()) { return; } if ((MISC::IS_BIT_SET(Global_4456448.f_15, 12) || Global_2460715) || Global_1315732) { return; } if (func_157()) { return; } if (((iLocal_120 != Global_2537071.f_4535 || Global_1319110 != -1) || func_191(iLocal_120)) || Global_1319116 != -1) { if (!iLocal_80 || Global_1319110 != -1) { if (!HUD::IS_HELP_MESSAGE_BEING_DISPLAYED()) { if ((bLocal_84 || bLocal_85) || bLocal_86) { if (iLocal_78 == joaat("buzzard") || iLocal_78 == joaat("savage")) { if (func_110(PLAYER::PLAYER_ID(), 19)) { if (!func_109()) { bVar0 = true; } } if (!bVar0) { func_48("HUNTGUN_1", -1); } } else if (iLocal_78 == joaat("valkyrie")) { if (func_110(PLAYER::PLAYER_ID(), 19)) { if (!func_109()) { bVar0 = true; } } if (!bVar0) { func_48("HUNTGUN_1c", -1); } } else if (iLocal_78 == joaat("hunter")) { if (func_110(PLAYER::PLAYER_ID(), 19)) { if (!func_109()) { bVar0 = true; } } if (!bVar0) { func_48("HUNTGUNH_1c", -1); } } else if (Global_1319110 != -1) { } else if (func_191(iLocal_120)) { if (!func_156(PLAYER::PLAYER_ID())) { if (iLocal_78 == joaat("akula")) { if (bLocal_84) { func_48("AKULAGUN_1", -1); } else if (bLocal_85) { func_48("AKULAGUN_2", -1); } else if (bLocal_86) { func_48("AKULAGUN_2", -1); } } else if (iLocal_78 == joaat("volatol")) { if (bLocal_85) { if (!bLocal_102) { func_48("VOLGUN_1c2", -1); } else { func_48("VOLGUN_1c", -1); } } else if (bLocal_86) { if (!bLocal_98) { func_48("VOLGUN_2c1", -1); } else { func_48("VOLGUN_2c", -1); } } } else if (bLocal_84) { if (!bLocal_98) { func_48("BOMBGUN_1c1", -1); } else if (!bLocal_102) { func_48("BOMBGUN_1c2", -1); } else { func_48("BOMBGUN_1c", -1); } } else if (bLocal_85) { if (!bLocal_102) { func_48("BOMBGUN_2c2", -1); } else if (!bLocal_91) { func_48("BOMBGUN_2c1", -1); } else { func_48("BOMBGUN_2c", -1); } } else if (bLocal_86) { if (!bLocal_91) { func_48("BOMBGUN_3c1", -1); } else if (!bLocal_98) { func_48("BOMBGUN_3c2", -1); } else { func_48("BOMBGUN_3c", -1); } } } } else { func_48("HUNTGUN_1b", -1); } iLocal_80 = 1; } else if ((((func_179() && !Global_2460715.f_132) && !Global_1315732) && iLocal_78 != joaat("hunter")) && !func_191(iLocal_120)) { if (iLocal_78 == joaat("buzzard") || iLocal_78 == joaat("savage")) { func_48("HUNTGUN_3", -1); } else if (iLocal_78 == joaat("valkyrie")) { func_48("HUNTGUN_3c", -1); } else { func_48("HUNTGUN_3b", -1); } iLocal_80 = 1; } } else if (func_41("VEX_EYEHLPe")) { iLocal_80 = 1; } } else if (func_169(PLAYER::PLAYER_ID(), 1) || func_166(PLAYER::PLAYER_ID(), 1, 0)) { if (!HUD::IS_HELP_MESSAGE_BEING_DISPLAYED()) { if (!iLocal_83) { if (!bLocal_84) { if (func_165()) { iLocal_83 = 1; Global_2537071.f_4535 = iLocal_120; } } else { iLocal_83 = 1; Global_2537071.f_4535 = iLocal_120; } } } } else { iLocal_83 = 1; Global_2537071.f_4535 = iLocal_120; } } else { iLocal_80 = 1; iLocal_83 = 1; } } int func_165() { return 0; } int func_166(int iParam0, bool bParam1, bool bParam2) { if (bParam1) { if (func_167(iParam0)) { return 1; } } if (!bParam2) { } if (Global_1590535[iParam0 /*876*/] == -1) { return 0; } return 1; } bool func_167(int iParam0) { return func_168(iParam0); } bool func_168(int iParam0) { return MISC::IS_BIT_SET(Global_1590535[iParam0 /*876*/].f_13.f_1, 0); } int func_169(int iParam0, bool bParam1) { if (bParam1) { if (func_167(iParam0)) { return 1; } } if ((((Global_1590535[iParam0 /*876*/] == 2 || Global_1590535[iParam0 /*876*/] == 1) || Global_1590535[iParam0 /*876*/] == 0) || Global_1590535[iParam0 /*876*/] == 3) || Global_1590535[iParam0 /*876*/] == 8) { return 1; } return 0; } bool func_170() { return ((((((((((((!iLocal_80 && !func_156(PLAYER::PLAYER_ID())) && !CAM::IS_SCREEN_FADING_IN()) && !CAM::IS_SCREEN_FADED_OUT()) && !CAM::IS_SCREEN_FADING_OUT()) && CAM::IS_SCREEN_FADED_IN()) && !HUD::IS_RADAR_HIDDEN()) && HUD::IS_MINIMAP_RENDERING()) && !func_45()) && !HUD::IS_PAUSE_MENU_ACTIVE()) && !NETWORK::NETWORK_IS_IN_MP_CUTSCENE()) && !func_171()) && !func_39(PLAYER::PLAYER_ID())); } bool func_171() { return Global_1676377.f_474; } void func_172() { if (MISC::IS_PC_VERSION()) { if (bLocal_132 == 1) { PAD::_RESET_INPUT_MAPPING_SCHEME(); bLocal_132 = false; } } } void func_173() { func_174(); if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula") && (bLocal_85 || bLocal_86)) { if (Local_131[NETWORK::PARTICIPANT_ID_TO_INT() /*2*/].f_1 == 2) { if (iLocal_137 == 0) { switch (iLocal_133) { case 0: GRAPHICS::SET_NIGHTVISION(false); if (GRAPHICS::GET_USINGSEETHROUGH()) { GRAPHICS::_SEETHROUGH_SET_MAX_THICKNESS(Global_1661288); Global_1661288 = -1f; GRAPHICS::SET_SEETHROUGH(false); } break; case 1: GRAPHICS::SET_NIGHTVISION(true); if (GRAPHICS::GET_USINGSEETHROUGH()) { GRAPHICS::_SEETHROUGH_SET_MAX_THICKNESS(Global_1661288); Global_1661288 = -1f; GRAPHICS::SET_SEETHROUGH(false); } break; case 2: GRAPHICS::SET_NIGHTVISION(false); GRAPHICS::SET_SEETHROUGH(true); Global_1661288 = GRAPHICS::_SEETHROUGH_GET_MAX_THICKNESS(); GRAPHICS::_SEETHROUGH_SET_MAX_THICKNESS(0.5f); break; } iLocal_137 = 1; } } else if (iLocal_133 != 0) { GRAPHICS::SET_NIGHTVISION(false); if (GRAPHICS::GET_USINGSEETHROUGH()) { GRAPHICS::_SEETHROUGH_SET_MAX_THICKNESS(Global_1661288); Global_1661288 = -1f; GRAPHICS::SET_SEETHROUGH(false); } iLocal_133 = 0; } } } void func_174() { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula") && (bLocal_85 || bLocal_86)) { if (PAD::IS_CONTROL_JUST_PRESSED(0, 226)) { if (iLocal_133 == 2) { iLocal_133 = 0; } else { iLocal_133++; } iLocal_137 = 0; } if (PAD::IS_CONTROL_JUST_PRESSED(0, 227)) { if (iLocal_133 == 0) { iLocal_133 = 2; } else { iLocal_133 = (iLocal_133 - 1); } iLocal_137 = 0; } } } void func_175() { switch (iLocal_78) { case joaat("akula"): return; default: } if (MISC::IS_BIT_SET(Global_4456448.f_15, 12) || Global_2460715) { return; } if (iLocal_124 == PLAYER::PLAYER_ID() && iLocal_78 != joaat("bombushka")) { if (func_176(iLocal_120)) { if ((iLocal_93 && !iLocal_82) && (PAD::IS_CONTROL_JUST_PRESSED(0, 99) || PAD::IS_CONTROL_JUST_PRESSED(0, 100))) { if (!HUD::IS_HELP_MESSAGE_BEING_DISPLAYED()) { func_48("HUNTGUN_8", -1); iLocal_82 = 1; } } } } } int func_176(int iParam0) { int iVar0; iVar0 = ENTITY::GET_ENTITY_MODEL(ENTITY::GET_VEHICLE_INDEX_FROM_ENTITY_INDEX(iParam0)); if (ENTITY::GET_ENTITY_MODEL(iParam0) == joaat("akula")) { return 1; } if (Global_2462227) { return 0; } if (iVar0 == joaat("buzzard")) { return 1; } if (iVar0 == joaat("savage")) { return 1; } if (Global_1319110 != -1 && MISC::IS_BIT_SET(Global_4456448.f_25, 7)) { return 1; } if (Global_1319110 != -1 && !func_43(Global_1590374)) { return 1; } if (func_191(iParam0)) { return 1; } if (Global_1319116 != -1) { return 1; } return 0; } void func_177() { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula") && (bLocal_85 || bLocal_86)) { return; } if (VEHICLE::IS_VEHICLE_DRIVEABLE(iLocal_120, false)) { if (!ENTITY::IS_ENTITY_IN_AIR(iLocal_120)) { if (func_191(iLocal_120)) { if (func_178()) { if (bLocal_85) { if (Local_71.f_214 == 0) { Local_71.f_214 = 1; } } } else if (Local_71.f_214 == 1) { Local_71.f_214 = 0; } } else if (func_179()) { Local_71.f_214 = 1; } else { CAM::_CLAMP_GAMEPLAY_CAM_PITCH(-25f, 6f); Local_71.f_214 = 0; } } else { Local_71.f_214 = 0; } } } int func_178() { int iVar0; if (bLocal_98) { if (!bLocal_99) { iVar0 = iLocal_100; if (iVar0 != -1) { return Global_1590535[iVar0 /*876*/].f_732; } } } return 0; } int func_179() { int iVar0; if (bLocal_91) { if (!bLocal_92) { iVar0 = iLocal_125; if (iVar0 != -1) { return Global_1590535[iVar0 /*876*/].f_732; } } } return 0; } int func_180() { if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { return 0; } return 1; } int func_181(var uParam0) { if (uParam0->f_1 == 1) { return 1; } return 0; } void func_182() { if (func_122(&uLocal_107)) { PAD::DISABLE_CONTROL_ACTION(0, 80, true); Global_1319117 = 1; if (func_121(&uLocal_107, 1000, 1)) { func_147(&uLocal_107); Global_1319117 = 0; } } } void func_183() { int iVar0; if (!PED::IS_PED_INJURED(PLAYER::PLAYER_PED_ID()) && PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), false)) { iVar0 = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false); if (((ENTITY::DOES_ENTITY_EXIST(iVar0) && VEHICLE::IS_VEHICLE_DRIVEABLE(iVar0, false)) && func_191(iVar0)) && NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(iVar0)) { VEHICLE::_0x78CEEE41F49F421F(iVar0, 0); } } } void func_184() { PAD::DISABLE_CONTROL_ACTION(0, 24, true); PAD::DISABLE_CONTROL_ACTION(0, 66, true); PAD::DISABLE_CONTROL_ACTION(0, 67, true); PAD::DISABLE_CONTROL_ACTION(0, 68, true); PAD::DISABLE_CONTROL_ACTION(0, 114, true); PAD::DISABLE_CONTROL_ACTION(0, 69, true); PAD::DISABLE_CONTROL_ACTION(0, 70, true); PAD::DISABLE_CONTROL_ACTION(0, 91, true); PAD::DISABLE_CONTROL_ACTION(0, 92, true); PAD::DISABLE_CONTROL_ACTION(0, 99, true); PAD::DISABLE_CONTROL_ACTION(0, 100, true); PAD::DISABLE_CONTROL_ACTION(0, 37, true); } int func_185(int iParam0) { int iVar0; iVar0 = iParam0; if (iVar0 != -1) { return Global_1628237[iVar0 /*615*/]; } return -1; } void func_186() { if (ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("akula") || ENTITY::GET_ENTITY_MODEL(iLocal_120) == joaat("phantom3")) { if (bLocal_85 || bLocal_86) { PAD::DISABLE_CONTROL_ACTION(0, 24, true); PAD::DISABLE_CONTROL_ACTION(0, 66, true); PAD::DISABLE_CONTROL_ACTION(0, 67, true); PAD::DISABLE_CONTROL_ACTION(0, 114, true); PAD::DISABLE_CONTROL_ACTION(0, 69, true); PAD::DISABLE_CONTROL_ACTION(0, 91, true); PAD::DISABLE_CONTROL_ACTION(0, 92, true); } } } void func_187() { if (func_125()) { if ((((Local_131[NETWORK::PARTICIPANT_ID_TO_INT() /*2*/].f_1 == 1 || Local_131[NETWORK::PARTICIPANT_ID_TO_INT() /*2*/].f_1 == 2) || Global_1319116 != -1) && CAM::DOES_CAM_EXIST(Local_71.f_32)) && CAM::IS_CAM_RENDERING(Local_71.f_32)) { if (!STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS()) { STREAMING::SET_FOCUS_POS_AND_VEL(CAM::GET_CAM_COORD(Local_71.f_32), CAM::GET_CAM_ROT(Local_71.f_32, 2)); } } } } void func_188() { int iVar0; iVar0 = -1; if (Global_1319116 != -1 && func_124(3)) { if (PAD::IS_CONTROL_JUST_PRESSED(0, 226)) { iVar0 = func_26(1); Local_71.f_186 = { 0f, 0f, 0f }; } else if (PAD::IS_CONTROL_JUST_PRESSED(0, 227)) { iVar0 = func_26(0); Local_71.f_186 = { 0f, 0f, 0f }; } } if (func_25(iVar0)) { func_189(iVar0); } } void func_189(int iParam0) { Global_1319116 = iParam0; Local_71.f_35 = 0; func_147(&uLocal_75); } void func_190() { int iVar0; iVar0 = -1; if (Global_1319116 != -1 && (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID()))) { if (PAD::IS_CONTROL_JUST_PRESSED(0, 226)) { iVar0 = func_22(0); Local_71.f_186 = { 0f, 0f, 0f }; } else if (PAD::IS_CONTROL_JUST_PRESSED(0, 227)) { iVar0 = func_22(1); Local_71.f_186 = { 0f, 0f, 0f }; } } if (func_21(iVar0)) { func_189(iVar0); } } int func_191(int iParam0) { int iVar0; if (!ENTITY::DOES_ENTITY_EXIST(iParam0)) { return 0; } iVar0 = ENTITY::GET_ENTITY_MODEL(iParam0); switch (iVar0) { case joaat("bombushka"): case joaat("volatol"): case joaat("akula"): return 1; default: } return 0; } void func_192(int iParam0) { if (NETWORK::PARTICIPANT_ID_TO_INT() != -1) { Local_131[NETWORK::PARTICIPANT_ID_TO_INT() /*2*/] = iParam0; } } int func_193(int iParam0) { if (iParam0 != func_17()) { if (func_15(iParam0, 1, 1)) { if (Global_2425662[iParam0 /*421*/].f_310.f_5 != -1 && Global_2425662[iParam0 /*421*/].f_310.f_8 != func_17()) { return func_37(Global_2425662[iParam0 /*421*/].f_310.f_5) == 5; } } } return 0; } void func_194(var uParam0, bool bParam1, bool bParam2) { if (NETWORK::NETWORK_IS_GAME_IN_PROGRESS() && !bParam1) { if (!bParam2) { *uParam0 = NETWORK::GET_NETWORK_TIME(); } else { *uParam0 = NETWORK::GET_NETWORK_TIME_ACCURATE(); } } else { *uParam0 = MISC::GET_GAME_TIMER(); } uParam0->f_1 = 1; } int func_195() { if (((func_207(joaat("hunter")) && func_123(iLocal_122)) && iLocal_122 == PLAYER::PLAYER_PED_ID()) && !func_123(iLocal_123)) { return 1; } if (func_215()) { return 1; } if (func_197(0)) { return 1; } if (Global_1661981) { return 1; } if (!func_124(3)) { if (Global_1312791) { return 1; } } if (Global_1319109) { return 1; } if (Global_1574191) { return 1; } if (Global_1574397) { return 1; } if (Global_1662006) { return 1; } if (!NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { func_210(); } if (func_196()) { return 1; } if (NETWORK::NETWORK_IS_PLAYER_IN_MP_CUTSCENE(PLAYER::PLAYER_ID())) { return 1; } if (func_69()) { return 1; } if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { if (Global_1319110 == -1) { return 1; } else { return 0; } } if (func_141(PLAYER::PLAYER_ID()) || func_140(PLAYER::PLAYER_ID())) { if (Global_1319116 == -1) { return 1; } else { return 0; } } if (func_125()) { if (Global_1319116 == -1) { return 1; } } return 0; } bool func_196() { return Global_1312877; } int func_197(bool bParam0) { if (func_206()) { if (bParam0) { if (!Global_1574405 && !func_110(PLAYER::PLAYER_ID(), 2)) { GRAPHICS::ANIMPOSTFX_PLAY("MinigameTransitionIn", 0, true); func_198(0, 0); } } return 1; } return 0; } void func_198(bool bParam0, int iParam1) { if (bParam0) { func_203(1, 0, 1); } else { func_199(iParam1); } } void func_199(int iParam0) { func_202(); if (iParam0 == 0) { if (LOADINGSCREEN::_LOADINGSCREEN_GET_LOAD_FREEMODE()) { return; } } if (func_201() == 0 || HUD::IS_PAUSE_MENU_ACTIVE()) { func_200(1); GRAPHICS::TOGGLE_PAUSED_RENDERPHASES(false); GRAPHICS::TOGGLE_PAUSED_RENDERPHASES(false); } } void func_200(int iParam0) { if (Global_1312467.f_20 != iParam0) { Global_1312467.f_20 = iParam0; } } int func_201() { return Global_1312467.f_20; } void func_202() { Global_2462226 = 1; } void func_203(int iParam0, bool bParam1, bool bParam2) { if (func_204()) { return; } if ((func_201() == 1 || HUD::IS_PAUSE_MENU_ACTIVE()) || iParam0) { func_200(0); GRAPHICS::TOGGLE_PAUSED_RENDERPHASES(true); if (!bParam1) { GRAPHICS::TOGGLE_PAUSED_RENDERPHASES(true); } if (bParam2) { GRAPHICS::RESET_PAUSED_RENDERPHASES(); } } } int func_204() { if (func_205()) { return Global_2460590; } return 0; } int func_205() { if (Global_2460583) { return Global_2460582; } return 0; } bool func_206() { return Global_2439138.f_2; } bool func_207(int iParam0) { return (iLocal_121 == iParam0 && iParam0 != 0); } void func_208() { int iVar0; iVar0 = PLAYER::PLAYER_PED_ID(); iLocal_121 = 0; bLocal_89 = false; bLocal_90 = true; bLocal_99 = true; bLocal_103 = true; bLocal_91 = false; bLocal_92 = true; iLocal_122 = -1; iLocal_123 = -1; iLocal_124 = func_17(); iLocal_125 = func_17(); bLocal_84 = false; Global_1574315 = func_17(); bLocal_94 = false; iLocal_97 = -1; bLocal_98 = false; iLocal_100 = func_17(); iLocal_101 = -1; bLocal_102 = false; iLocal_104 = func_17(); if (ENTITY::DOES_ENTITY_EXIST(iVar0)) { if (!ENTITY::IS_ENTITY_DEAD(iVar0, false)) { if (ENTITY::DOES_ENTITY_EXIST(iLocal_120) && VEHICLE::IS_VEHICLE_DRIVEABLE(iLocal_120, false)) { iLocal_121 = ENTITY::GET_ENTITY_MODEL(iLocal_120); bLocal_94 = true; if (!VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, -1, false)) { iLocal_122 = VEHICLE::GET_PED_IN_VEHICLE_SEAT(iLocal_120, -1, 0); bLocal_89 = ENTITY::DOES_ENTITY_EXIST(iLocal_122); if (bLocal_89) { bLocal_90 = ENTITY::IS_ENTITY_DEAD(iLocal_122, false); if (PED::IS_PED_A_PLAYER(iLocal_122)) { iLocal_124 = NETWORK::NETWORK_GET_PLAYER_INDEX_FROM_PED(iLocal_122); } } } if (!VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 0, false)) { iLocal_123 = VEHICLE::GET_PED_IN_VEHICLE_SEAT(iLocal_120, 0, 0); bLocal_91 = ENTITY::DOES_ENTITY_EXIST(iLocal_123); if (bLocal_91) { bLocal_92 = ENTITY::IS_ENTITY_DEAD(iLocal_123, false); if (func_209(iLocal_123, iLocal_120, 0) && PED::IS_PED_IN_VEHICLE(iLocal_123, iLocal_120, false)) { if (PED::IS_PED_A_PLAYER(iLocal_123)) { iLocal_125 = NETWORK::NETWORK_GET_PLAYER_INDEX_FROM_PED(iLocal_123); if (iLocal_125 == PLAYER::PLAYER_ID()) { bLocal_84 = true; if (func_191(iLocal_120)) { Global_1319115 = 0; } } else { bLocal_84 = false; } } } } } else { iLocal_123 = -1; bLocal_91 = false; bLocal_84 = false; } if (func_191(iLocal_120)) { if (!VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 1, false)) { iLocal_97 = VEHICLE::GET_PED_IN_VEHICLE_SEAT(iLocal_120, 1, 0); bLocal_98 = ENTITY::DOES_ENTITY_EXIST(iLocal_97); if (bLocal_98) { bLocal_99 = ENTITY::IS_ENTITY_DEAD(iLocal_97, false); if (func_209(iLocal_97, iLocal_120, 1) && PED::IS_PED_IN_VEHICLE(iLocal_97, iLocal_120, false)) { if (PED::IS_PED_A_PLAYER(iLocal_97)) { iLocal_100 = NETWORK::NETWORK_GET_PLAYER_INDEX_FROM_PED(iLocal_97); if (iLocal_100 == PLAYER::PLAYER_ID()) { Global_1319115 = 1; bLocal_85 = true; } else { bLocal_85 = false; } } } } } else { iLocal_97 = -1; bLocal_98 = false; bLocal_85 = false; } if (!VEHICLE::IS_VEHICLE_SEAT_FREE(iLocal_120, 2, false)) { iLocal_101 = VEHICLE::GET_PED_IN_VEHICLE_SEAT(iLocal_120, 2, 0); bLocal_102 = ENTITY::DOES_ENTITY_EXIST(iLocal_101); if (bLocal_102) { bLocal_103 = ENTITY::IS_ENTITY_DEAD(iLocal_101, false); if (func_209(iLocal_101, iLocal_120, 2) && PED::IS_PED_IN_VEHICLE(iLocal_101, iLocal_120, false)) { if (PED::IS_PED_A_PLAYER(iLocal_101)) { iLocal_104 = NETWORK::NETWORK_GET_PLAYER_INDEX_FROM_PED(iLocal_101); if (iLocal_104 == PLAYER::PLAYER_ID()) { Global_1319115 = 2; bLocal_86 = true; } else { bLocal_86 = false; } } } } } else { bLocal_86 = false; bLocal_102 = false; iLocal_101 = -1; } } if (iLocal_125 == PLAYER::PLAYER_ID()) { if (!bLocal_90) { Global_1574315 = iLocal_124; } } else if (!bLocal_92) { Global_1574315 = iLocal_125; } } } } if (Global_1319110 != -1) { bLocal_92 = false; iLocal_125 = PLAYER::PLAYER_ID(); if (iLocal_125 == PLAYER::PLAYER_ID()) { bLocal_84 = true; } } } int func_209(int iParam0, int iParam1, int iParam2) { if (!ENTITY::IS_ENTITY_DEAD(iParam0, false) && !ENTITY::IS_ENTITY_DEAD(iParam1, false)) { if (PED::IS_PED_SITTING_IN_VEHICLE(iParam0, iParam1)) { if (VEHICLE::GET_PED_IN_VEHICLE_SEAT(iParam1, iParam2, 0) == iParam0) { return 1; } } } return 0; } void func_210() { int iVar0; func_145(0); func_172(); func_214(); if (MISC::IS_BIT_SET(iLocal_113, 0)) { PED::SET_PED_CONFIG_FLAG(PLAYER::PLAYER_PED_ID(), 184, MISC::IS_BIT_SET(iLocal_113, 1)); } if (Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_847) { HUD::UNLOCK_MINIMAP_POSITION(); } Global_2513487 = 0; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_847 = 0; func_71(); func_146(); Global_1319109 = 0; if (ENTITY::DOES_ENTITY_EXIST(iLocal_120)) { if (iLocal_122 == PLAYER::PLAYER_PED_ID() && NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(iLocal_120)) { VEHICLE::DISABLE_VEHICLE_WEAPON(false, joaat("vehicle_weapon_space_rocket"), iLocal_120, PLAYER::PLAYER_PED_ID()); } } Global_1319117 = 0; func_71(); func_213(); if (HUD::DOES_BLIP_EXIST(iLocal_126)) { HUD::REMOVE_BLIP(&iLocal_126); } if (HUD::DOES_BLIP_EXIST(iLocal_127)) { HUD::REMOVE_BLIP(&iLocal_127); } if (HUD::DOES_BLIP_EXIST(HUD::GET_MAIN_PLAYER_BLIP_ID())) { HUD::SET_BLIP_ALPHA(HUD::GET_MAIN_PLAYER_BLIP_ID(), 255); } func_135(&Local_71, iVar0, 0, iLocal_120, 1); Global_2547057 = 0; Global_1319111 = 0; Global_1573326 = 0; Global_1590535[PLAYER::PLAYER_ID() /*876*/].f_732 = 0; if ((Global_1319110 != -1 || func_191(iLocal_120)) || Global_1319116 != -1) { HUD::UNLOCK_MINIMAP_POSITION(); Global_1319110 = -1; Global_1319115 = -1; Global_1319116 = -1; } if (iLocal_77 == 1) { PLAYER::SET_WANTED_LEVEL_MULTIPLIER(1f); } AUDIO::STOP_AUDIO_SCENE("CAR_2_HELI_FILTERING"); func_212(); func_147(&uLocal_75); func_211(); } void func_211() { SCRIPT::TERMINATE_THIS_THREAD(); } void func_212() { if (iLocal_114 != 0) { AUDIO::STOP_AUDIO_SCENE(func_5(iLocal_114)); } if (Local_71.f_211 != -1) { AUDIO::STOP_SOUND(Local_71.f_211); AUDIO::RELEASE_SOUND_ID(Local_71.f_211); Local_71.f_211 = -1; } if (iLocal_119 != 99 && iLocal_119 > 0) { AUDIO::STOP_AUDIO_SCENE("MP_HELI_CAM_FILTERING"); iLocal_119 = 99; } } void func_213() { if (bLocal_84) { PED::REMOVE_PED_HELMET(PLAYER::PLAYER_PED_ID(), false); } } void func_214() { if (iLocal_133 != 0) { GRAPHICS::SET_NIGHTVISION(false); if (GRAPHICS::GET_USINGSEETHROUGH()) { GRAPHICS::_SEETHROUGH_SET_MAX_THICKNESS(Global_1661288); Global_1661288 = -1f; GRAPHICS::SET_SEETHROUGH(false); } iLocal_133 = 0; } } int func_215() { var uVar0; func_222(&uVar0); if (Global_1312854 == 0) { if (!NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { return 1; } } if (func_221()) { return 1; } if (Global_2462922) { return 1; } if (func_220()) { return 1; } if (func_219(159)) { if (!func_218()) { return 1; } } if (func_219(157)) { return 1; } if (!NETWORK::NETWORK_IS_SIGNED_ONLINE()) { return 1; } if (func_216() != 0) { if (SCRIPT::_GET_NUMBER_OF_REFERENCES_OF_SCRIPT_WITH_NAME_HASH(func_216()) == 0) { return 1; } } return 0; } int func_216() { switch (func_67()) { case 0: return func_217(); break; case 2: return joaat("creator"); break; } return 0; } int func_217() { switch (Global_2463024) { case 0: return joaat("freemode"); default: } return joaat("freemode"); } bool func_218() { return Global_2450632.f_598; } int func_219(int iParam0) { if (SCRIPT::GET_EVENT_EXISTS(1, iParam0)) { return 1; } return 0; } bool func_220() { return Global_2460680; } bool func_221() { return Global_2450632.f_593; } void func_222(var uParam0) { int iVar0; int iVar1; int iVar2; struct<3> Var3; iVar0 = 0; while (iVar0 < SCRIPT::GET_NUMBER_OF_EVENTS(1)) { iVar1 = SCRIPT::GET_EVENT_AT_INDEX(1, iVar0); if (iVar1 == 174) { SCRIPT::GET_EVENT_DATA(1, iVar0, &iVar2, 2); switch (iVar2) { case -1853120870: func_223(iVar0); break; case 589125870: SCRIPT::GET_EVENT_DATA(1, iVar0, &Var3, 4); if (Var3.f_2 == 653923311) { *uParam0 = 1; } break; } } iVar0++; } } void func_223(int iParam0) { struct<3> Var0; int iVar1; int iVar2; bool bVar3; if (SCRIPT::GET_EVENT_DATA(1, iParam0, &Var0, 3)) { if (func_15(Var0.f_1, 1, 1)) { iVar1 = PLAYER::GET_PLAYER_PED(Var0.f_1); if (ENTITY::DOES_ENTITY_EXIST(iVar1)) { if (PED::IS_PED_IN_ANY_VEHICLE(iVar1, false)) { iVar2 = PED::GET_VEHICLE_PED_IS_IN(iVar1, false); if (VEHICLE::IS_VEHICLE_WINDOW_INTACT(iVar2, Var0.f_2) && NETWORK::NETWORK_GET_THIS_SCRIPT_IS_NETWORK_SCRIPT()) { if (func_224(iVar2, &bVar3)) { VEHICLE::REMOVE_VEHICLE_WINDOW(iVar2, Var0.f_2); } if (bVar3) { ENTITY::SET_VEHICLE_AS_NO_LONGER_NEEDED(&iVar2); } } } } } } } int func_224(int iParam0, var uParam1) { if (ENTITY::DOES_ENTITY_EXIST(iParam0)) { if (!ENTITY::IS_ENTITY_A_MISSION_ENTITY(iParam0)) { if (NETWORK::NETWORK_GET_ENTITY_IS_LOCAL(iParam0)) { if (!VEHICLE::IS_THIS_MODEL_A_TRAIN(ENTITY::GET_ENTITY_MODEL(iParam0))) { ENTITY::SET_ENTITY_AS_MISSION_ENTITY(iParam0, false, true); *uParam1 = 1; } } } if (ENTITY::DOES_ENTITY_BELONG_TO_THIS_SCRIPT(iParam0, false)) { if (NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(iParam0)) { return 1; } } } return 0; } void func_225() { SYSTEM::WAIT(0); } void func_226(struct<21> Param0) { func_230(func_231(Param0), Param0); func_228(0, -1, 0); NETWORK::NETWORK_REGISTER_HOST_BROADCAST_VARIABLES(&iLocal_130, 1); NETWORK::NETWORK_REGISTER_PLAYER_BROADCAST_VARIABLES(&Local_131, 5); MISC::SET_THIS_SCRIPT_CAN_BE_PAUSED(false); if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID())) { if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false)) { if (PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), false)) { if (VEHICLE::IS_VEHICLE_DRIVEABLE(PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()), false)) { iLocal_78 = ENTITY::GET_ENTITY_MODEL(PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID())); iLocal_120 = PED::GET_VEHICLE_PED_IS_USING(PLAYER::PLAYER_PED_ID()); iLocal_79 = joaat("w_lr_rpg_rocket"); if (iLocal_79 != 0) { STREAMING::REQUEST_MODEL(iLocal_79); } } } } } if (Global_1319110 != -1 || Global_1319116 != -1) { if (func_193(PLAYER::PLAYER_ID()) || func_142(PLAYER::PLAYER_ID())) { if (MISC::IS_BIT_SET(Global_4456448.f_25, 7)) { if (iLocal_120 != Global_2537071.f_305) { iLocal_120 = Global_2537071.f_305; } } else if (iLocal_120 != Global_1370236) { iLocal_120 = Global_1370236; } } else if (func_141(PLAYER::PLAYER_ID())) { iLocal_120 = Global_1370251; if (ENTITY::DOES_ENTITY_EXIST(iLocal_120)) { } } else if (func_140(PLAYER::PLAYER_ID())) { iLocal_120 = Global_2537071.f_307; if (ENTITY::DOES_ENTITY_EXIST(iLocal_120)) { } } else if (func_75(PLAYER::PLAYER_ID()) || func_124(3)) { iLocal_120 = Global_1676352; } if (func_140(PLAYER::PLAYER_ID()) || func_141(PLAYER::PLAYER_ID())) { Local_71.f_38 = 40f; } } if (!func_227()) { func_210(); } func_192(0); } int func_227() { int iVar0; iVar0 = 0; while (true) { iVar0++; if (!NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { return 0; } if (NETWORK::_0x5D10B3795F3FC886()) { return 1; } if (func_221()) { return 0; } if (func_219(157)) { return 0; } if (iVar0 >= 3600) { return 0; } SYSTEM::WAIT(0); } return 0; } int func_228(int iParam0, int iParam1, bool bParam2) { int iVar0; iVar0 = NETWORK::NETWORK_GET_SCRIPT_STATUS(); while (iVar0 != 2) { if (((iVar0 == 3 || iVar0 == 4) || iVar0 == 5) || iVar0 == 6) { if (!bParam2) { func_211(); } else { return 0; } } if (!func_229()) { if (iParam0 == 0) { if (!NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { if (!bParam2) { func_211(); } else { return 0; } } if (func_221()) { if (!bParam2) { func_211(); } else { return 0; } } if (func_219(157)) { if (!bParam2) { func_211(); } else { return 0; } } } else if (!NETWORK::NETWORK_IS_IN_SESSION()) { if (!bParam2) { func_211(); } else { return 0; } } } SYSTEM::WAIT(0); iVar0 = NETWORK::NETWORK_GET_SCRIPT_STATUS(); } if (iParam1 > -1) { Global_1312501 = iVar0; } if (iParam0 == 0) { if (!NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { if (!bParam2) { func_211(); } else { return 0; } } } else if (!NETWORK::NETWORK_IS_IN_SESSION()) { if (!bParam2) { func_211(); } else { return 0; } } return 1; } bool func_229() { return Global_1312854; } void func_230(int iParam0, struct<17> Param1, var uParam2, var uParam3, var uParam4, var uParam5) { if (!NETWORK::NETWORK_IS_GAME_IN_PROGRESS()) { func_211(); } NETWORK::NETWORK_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT(iParam0, false, Param1.f_16); } int func_231(int iParam0) { switch (iParam0) { case 3: return 2; case 1: return 32; case 32: return 32; case 33: return 32; case 34: return 32; case 35: return 32; case 36: return 32; case 37: return 32; case 38: return 32; case 39: return 32; case 40: return 32; case 41: return 32; case 42: return 32; case 43: return 32; case 44: return 32; case 45: return 32; case 46: return 32; case 47: return 32; case 48: return 32; case 49: return 32; case 50: return 4; case 51: return 32; case 52: return 32; case 53: return 32; case 54: return 32; case 55: return 32; case 56: return 32; case 57: return 32; case 58: return 32; case 59: return 32; case 60: return 32; case 61: return 32; case 62: return 32; case 63: return 32; case 64: return 4; case 65: return 32; case 66: return 4; case 67: return 4; case 68: return 32; case 69: return 32; case 70: return 4; case 71: return 32; case 72: return 32; case 73: case 74: return 4; case 75: return 32; case 76: return 32; case 77: return 32; case 78: return 32; case joaat("MPSV_LP0_31"): return 32; case 80: return 32; case 81: return 32; case 82: return 32; case 84: return 32; case 83: return 32; case 85: return 32; case 86: return 8; case 87: return 32; case 88: return 32; case 89: return 32; case 90: return 32; case 91: return 8; case 92: return 32; case 93: return 8; case 94: return 8; case 102: return 8; case 95: return 8; case 96: return 32; case 97: return 32; case 98: return 32; case 99: return 8; case 100: return 32; case 101: return 32; case 103: return 32; case 104: return 32; case 105: return 32; case 106: return 8; case 107: return 8; case 108: return 8; case 109: return 8; case 110: return 8; case 111: return 8; case 112: return 8; case 113: return 8; case 114: return 32; case 115: return 8; case 116: return 8; case 117: return 8; case 118: return 8; case 119: return 32; case 120: return 32; case 121: return 32; case 122: return 32; case 123: return 8; case 124: return 8; case 125: return 8; case 126: return 8; case 127: return 32; case 128: return 32; case 129: return 32; case 12: return 32; case 4: return 16; case 13: return 32; case 5: return 16; case 6: return 2; case 8: return 2; case 9: return 2; case 7: return 16; case 10: return 2; case 11: return 4; case 15: return 32; case 16: return 32; case 27: return 2; case 25: return 2; case 26: return 2; case 18: return 32; case 28: return 32; case 29: return 2; case 30: return 32; case 31: return 32; case 17: return 2; case 130: return 32; case 131: return 32; case 19: return 32; case 22: return 32; case 23: return 32; case 24: return 32; case 20: return 2; case 0: return 0; case 21: return 32; case 142: return 32; case 143: return 32; case 132: return 32; case 133: return 32; case 137: return 32; case 135: return 32; case 136: return 32; case 140: return 32; case 141: return 32; case 138: return 32; case 139: return 32; case 144: return 32; case 145: return 32; case 146: return 32; case 147: return 32; case 148: return 2; case 153: return 1; case 149: return 2; case 150: return 4; case 151: return 2; case 152: return 2; case 134: return 1; case 154: return 2; case 155: case 156: case 157: case 158: case 159: case 160: return 0; case 176: return 1; case 161: return 4; case 164: return 4; case 165: return 1; case 166: return 1; case 172: return 1; case 168: return 2; case 173: return 1; case 169: return 1; case 167: return 2; case 170: return 8; case 171: return 8; case 174: return 1; case 162: return 16; case 163: return 32; default: } return 0; }
As I’ve previously noted, infants are much more vulnerable to radiation than adults. And see this. However, radiation safety standards are set based on the assumption that everyone exposed is a healthy man in his 20s. Now, a physician (Janette D. Sherman, M. D.) and epidemiologist (Joseph Mangano) have penned a short but horrifying essay asking whether a spike in infant deaths in the Northwest are due to Fukushima: The recent CDC Morbidity and Mortality Weekly Report indicates that eight cities in the northwest U.S. (Boise ID, Seattle WA, Portland OR, plus the northern California cities of Santa Cruz, Sacramento, San Francisco, San Jose, and Berkeley) reported the following data on deaths among those younger than one year of age: 4 weeks ending March 19, 2011 – 37 deaths (avg. 9.25 per week) 10 weeks ending May 28, 2011 – 125 deaths (avg.12.50 per week) This amounts to an increase of 35% (the total for the entire U.S. rose about 2.3%), and is statistically significant. Of further significance is that those dates include the four weeks before and the ten weeks after the Fukushima Nuclear Power Plant disaster. In 2001 the infant mortality was 6.834 per 1000 live births, increasing to 6.845 in 2007. All years from 2002 to 2007 were higher than the 2001 rate. *** Data from Chernobyl, which exploded 25 years ago, clearly shows increased numbers of sick and weak newborns and increased numbers of deaths in the unborn and newborns, especially soon after the meltdown. These occurred in Europe as well as the former Soviet Union. Similar findings are also seen in wildlife living in areas with increased radioactive fallout levels. (Chernobyl – Consequences of the Catastrophe for People and the Environment, Alexeiy V. Yablokov, Vasily B. Nesterenko, and Alexey V. Nesterenko. Consulting Editor: Janette D. Sherman-Nevinger. New York Academy of Sciences, 2009.) Levels of radioisotopes were measured in children who had died in the Minsk area that had received Chernobyl fallout. The cardiac findings were the same as those seen in test animals that had been administered Cs-137. Bandashevsky, Y. I, Pathology of Incorporated Ionizing Radiation, Belarus Technical University, Minsk. 136 pp., 1999. For his pioneering work, Prof. Bandashevsky was arrested in 2001 and imprisoned for five years of an eight year sentence. *** Why should we care if there may be is a link between Fukushima and the death of children? Because we need to measure the actual levels of isotopes in the environment and in the bodies of people exposed to determine if the fallout is killing our most vulnerable. The research is not technically difficult – the political and economic barriers may be greater. Bandshevsky and others did it and confirmed the connection. The information is available in the Chernobyl book. (Previously cited.) The biological findings of Chernobyl cannot be ignored: isotope incorporation will determine the future of all life on earth – animal, fish, bird, plant and human. It is crucial to know this information if we are to avoid further catastrophic damage.
This invention relates to a method of and apparatus for controlling the optical reading of information which is recorded on a record medium and, more particularly, to such a method and apparatus wherein the focussing of a beam of radiant energy which is used to read the recorded information is adjusted to compensate for defocussing effects which may arise because of changes in the beam transmission path. Techniques are known wherein information is recorded on a record medium in a form capable of being reproduced, or read, by a light beam. As one example, video information is recorded in concentric, circular or spiral tracks on a rotatable disc, the information being in the form of modulated pits which are detectable by transmitting a light beam, such as a laser beam, onto the circular tracks, whereby the intensity of the light beam is modulated by the pits. If this modulated light beam then is reflected from the disc, the recorded information can be recovered by detecting the intensity modulations of the reflected beam. In other types of optical record media, information, which may be digital or analog, is recorded and a light beam is transmitted through the record medium with the intensity of the beam being modulated as a function of the recorded information. In practical embodiments of the foregoing, the density of the recorded information is relatively high. For the example wherein video information is recorded as optically-detectable characteristics, sometimes referred to as a video disc, the circular tracks are spaced closely to each other, and the track width is very narrow. This increases the amount of information which can be recorded on the disc. Because the tracks are so narrow, the impinging light beam should be controlled so that it does not drift from the track being scanned. That is, the area of the impinging beam, referred to as the beam spot, generally has a diameter that is approximately equal to the width of a track, and the beam spot should be centered on the track being scanned. In this regard, tracking control apparatus is provided to detect tracking errors, or deviations, as the beam scans each track and to use the detected tracking error to adjust the position of the impinging beam so as to effectively center the spot on the scanned track. Also, when the information recorded on a video disc is optically read, there is the possibility that the disc may not be perfectly flat on its bed. That is, if the disc is rotated on a turntable, eccentricities in the disc, in the turntable or in the rotating drive mechanism may displace the surface of the disc. In general, an objective lens is provided to focus the light beam precisely on the video disc so as to form the beam spot of desired size. However, this movement of the disc changes the distance between the objective lens and the surface thereof, thereby defocussing the impinging light beam. This has the effect of increasing the diameter of the beam spot, and therefore changes the intensity of the beam as reflected by the disc. Consequently, the modulations of the reflected beam intensity will include erroneous indications of information. To minimize this problem of beam defocussing, a focus servo control system has been proposed whereby changes in the impinging beam focussing are detected and used to modify the relative position of the objective lens with respect to the surface of the video disc. This focus servo control system thus tends to maintain the impinging beam in a focussed condition. This servo control operation is performed by transmitting an additional light beam through the same objective lens as is used to focus the main beam and then to detect changes in the focus condition of the impinging additional beam. More particularly, the intensity of the additional beam, as reflected by the disc, is detected, and changes in this additional beam intensity are indicative of changes in the focus condition thereof. Since the same objective lens is used both for the additional beam and for the main beam, and since changes in the focus condition of the additional beam may be considered to be attributed to changes in the distance between the objective lens and the surface of the record disc, changes in the additional beam intensity are used to correspondingly change the position of the objective lens in a direction to maintain a substantially constant distance between that lens and the disc. In order to avoid interference between the main light beam and the additional light beam, the additional beam is transmitted to a location on the objective lens which is spaced apart from the optical axis of the lens, the latter being the desired location along which the main beam is transmitted. Hence, the main and additional light beams are incident on the disc at spaced apart locations at its surface. However, the aforementioned tracking control technique which is used to control the proper tracking of the disc by the main beam also affects the location at which the additional beam impinges upon the disc. In general, the tracking control apparatus serves to simultaneously displace the transmission paths traversed by both the main beam and the additional beam. This means that the main beam may impinge upon the objective lens at a location spaced from the lens axis, and the additional beam likewise will impinge upon the objective lens at a still further spaced location. Now, if the focal surface of the objective lens is arcuate, then a displacement or shift in the locations at which the main and additional beams impinge upon the lens will result in respectively different focus conditions of these beams. In the usual focus servo control system, the objective lens will be moved in a direction to return the additional beam to its predetermined, focussed condition. However, because of the arcuate focal surface of the objective lens, the desired focus condition of the additional beam, which additional beam had been shifted by the tracking control apparatus, will be accompanied by a defocussed condition of the main beam which also had been shifted by the tracking control apparatus. Thus, although the usual focus servo control system operates satisfactorily in the absence of any tracking error, this servo control system provides an undesired, defocussed incident main beam in the event that a tracking error obtains. In optical video disc playback devices, a time-base error may be present in the reproduced video signals. That is, if the rotational speed of the record disc deviates from a proper speed, this deviation results in a time-base error in the intensity modulations of the read-out beam, which time-base error appears as an error in the frequency of the reproduced chrominance component. A time-base error correcting system has been proposed for optical video disc playack devices wherein the main read-out beam is displaced in a direction along the scanning path of the beam so as to compensate for frequency changes, or time-base errors in the recovered video information. This time-base error correcting system also displaces the aforementioned additional beam and, therefore, displaces the impinging locations of the main and additional beams on the objective lens. Consequently, the focus servo control system is subjected to the same beam defocussing problem when the time-base error correcting system is operative as when the tracking error correcting system is operative.
import {Component, OnInit} from "@angular/core"; import {Status} from "./shared/interfaces/status"; import {SessionService} from "./shared/services/session.service"; @Component({ selector: "lost-paws", template: require("./app.component.html") }) export class AppComponent implements OnInit{ status: Status = null; constructor(protected sessionService: SessionService) { } ngOnInit(){ this.sessionService.setSession() .subscribe(status => this.status = status); } }
A Lightweight LiDAR SLAM in Indoor-Outdoor Switch Environments Simultaneous Localization and Mapping (SLAM) can provide pose estimation and map information. It is widely used in Intelligent transportation systems such as smart vending vehicles. However, existing SLAM methods used for vending vehicles rarely focus on indoor environments. We proposed a real-time LiDAR-based SLAM with high accuracy in both outdoor and indoor environments. Our method takes the advantage of Inertial Measurement Unit (IMU) to reduce the distortion of raw data. Corner and planar features are extracted for point cloud registration. Besides, different optimization formulas are applied in different scenes. The proposed method achieves an average error of fewer than 1m in the KITTI Odometry benchmark and has high accuracy in different experiments.
Separation of particles using the focused acoustic sorting chip based on the wettability treatment Combining the focusing energy characteristics of the focused interdigital transducer with the self-cleaning function of the wettability surface, a focused acoustic sorting chip based on the surface wettability treatment is proposed in this work. In the laboratory, two kinds of focused acoustic sorting chips based on the hydrophilic and hydrophobic wall characteristics were designed and fabricated separately. The corresponding separation experiments were carried out using polystyrene microparticles with diameters of 1 and 10 m. Moreover, the particle adhesion characteristics based on different surface wettability and the effects of average velocity (Va) and input power (P) on particle deflection were investigated. The relevant optimum separation conditions were confirmed, namely under the hydrophilic treatment of the micro-channel surface, when the work frequency (f) was 131.83 MHz, Va = 4 mm/s, and P = 320 mW. Under these conditions, the optimal separation efficiency can reach 99.17%. The proposed chip has the advantages of simple structure, high separation accuracy, self-cleaning, and focusing energy.
<gh_stars>0 /* * Copyright 2000-2014 JetBrains s.r.o. * * 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. */ package com.intellij.vcs.log.graph.linearBek; import com.intellij.openapi.util.Condition; import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.graph.api.EdgeFilter; import com.intellij.vcs.log.graph.api.LinearGraph; import com.intellij.vcs.log.graph.api.elements.GraphEdge; import com.intellij.vcs.log.graph.api.elements.GraphEdgeType; import com.intellij.vcs.log.graph.api.elements.GraphNode; import com.intellij.vcs.log.graph.collapsing.EdgeStorageWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; public class LinearBekGraph implements LinearGraph { @NotNull protected final LinearGraph myGraph; @NotNull protected final EdgeStorageWrapper myHiddenEdges; @NotNull protected final EdgeStorageWrapper myDottedEdges; public LinearBekGraph(@NotNull LinearGraph graph) { myGraph = graph; myHiddenEdges = EdgeStorageWrapper.createSimpleEdgeStorage(); myDottedEdges = EdgeStorageWrapper.createSimpleEdgeStorage(); } @Override public int nodesCount() { return myGraph.nodesCount(); } @NotNull @Override public List<GraphEdge> getAdjacentEdges(int nodeIndex, @NotNull EdgeFilter filter) { List<GraphEdge> result = new ArrayList<GraphEdge>(); result.addAll(myDottedEdges.getAdjacentEdges(nodeIndex, filter)); result.addAll(myGraph.getAdjacentEdges(nodeIndex, filter)); result.removeAll(myHiddenEdges.getAdjacentEdges(nodeIndex, filter)); return result; } @NotNull @Override public GraphNode getGraphNode(int nodeIndex) { return myGraph.getGraphNode(nodeIndex); } @Override public int getNodeId(int nodeIndex) { return myGraph.getNodeId(nodeIndex); } @Nullable @Override public Integer getNodeIndex(int nodeId) { return myGraph.getNodeIndex(nodeId); } public Collection<GraphEdge> expandEdge(@NotNull final GraphEdge edge) { Set<GraphEdge> result = ContainerUtil.newHashSet(); assert edge.getType() == GraphEdgeType.DOTTED; myDottedEdges.removeEdge(edge); Integer tail = edge.getUpNodeIndex(); Integer firstChild = edge.getDownNodeIndex(); assert tail != null : "Collapsed from to an unloaded node"; assert firstChild != null : "Collapsed edge to an unloaded node"; List<GraphEdge> downDottedEdges = myHiddenEdges.getAdjacentEdges(tail, EdgeFilter.NORMAL_DOWN); List<GraphEdge> upDottedEdges = myHiddenEdges.getAdjacentEdges(firstChild, EdgeFilter.NORMAL_UP); for (GraphEdge e : ContainerUtil.concat(downDottedEdges, upDottedEdges)) { myHiddenEdges.removeEdge(e); if (e.getType() == GraphEdgeType.DOTTED) { result.addAll(expandEdge(e)); } else { result.add(e); } } return result; } public static class WorkingLinearBekGraph extends LinearBekGraph { private final LinearBekGraph myLinearGraph; public WorkingLinearBekGraph(@NotNull LinearBekGraph graph) { super(graph.myGraph); myLinearGraph = graph; } public Collection<GraphEdge> getAddedEdges() { Set<GraphEdge> result = myDottedEdges.getEdges(); result.removeAll(ContainerUtil.filter(myHiddenEdges.getEdges(), new Condition<GraphEdge>() { @Override public boolean value(GraphEdge graphEdge) { return graphEdge.getType() == GraphEdgeType.DOTTED; } })); result.removeAll(myLinearGraph.myDottedEdges.getEdges()); return result; } public Collection<GraphEdge> getRemovedEdges() { Set<GraphEdge> result = ContainerUtil.newHashSet(); Set<GraphEdge> hidden = myHiddenEdges.getEdges(); result.addAll(ContainerUtil.filter(hidden, new Condition<GraphEdge>() { @Override public boolean value(GraphEdge graphEdge) { return graphEdge.getType() != GraphEdgeType.DOTTED; } })); result.addAll(ContainerUtil.intersection(hidden, myLinearGraph.myDottedEdges.getEdges())); result.removeAll(myLinearGraph.myHiddenEdges.getEdges()); return result; } public void applyChanges() { myLinearGraph.myDottedEdges.removeAll(); myLinearGraph.myHiddenEdges.removeAll(); for (GraphEdge e : myDottedEdges.getEdges()) { myLinearGraph.myDottedEdges.createEdge(e); } for (GraphEdge e : myHiddenEdges.getEdges()) { myLinearGraph.myHiddenEdges.createEdge(e); } } } }
Electrochemical cells having thin planar anode assemblies have found particular applications in the medical field for use with heart pacemakers and other medical devices. General teachings concerning such cells may be found, for example, in U.S. Pat. No. 5,209,994 (hereinafter '994), assigned to the assignee of the present invention. The '994 cell includes a container of electrically conductive material which serves as a cathode current collector. The anode assembly of the cell includes a lithium element formed from two lithium halves which are pressed together with an anode current collector therebetween. The anode current collector extends to the exterior of the cell with use of an insulator which insulates a lead connected thereto from electrical contact with the container. The container is filled with a cathode material which is in operative contact with the exposed surfaces of the lithium element of the anode assembly. Similarly, the cathode material is in operative contact with the container. For enhanced performance of the cell, the opposed, major lateral surfaces (i.e., the "operative surfaces") of the lithium element may be coated with a film of electron donor material. More specifically, '994 describes this donor material as being a polymeric organic donor material such as poly (2-vinylpyridine). Such donor materials and application techniques for such materials are more fully described in U.S. Pat. No. 4,182,798. In operation, a chemical reaction between the lithium element and the cathode material in the container causes excess electrons to flow into the current collector. A chemical reaction between the cathode material and the container causes the container to be positively charged. The resulting voltage differential can be used to power a device. To prevent the cell from short-circuiting, the anode current collector is electrically insulated from the cathodic container and from the cathode material which fills the container. As noted above, an insulator (i.e., a feedthrough) allows the anode current collector to extend to the exterior of the container without making electrical contact with the cathodic container. Additionally, the anode current collector is protected from contact with the cathode material by the seal formed by cohesion between the two lithium halves between which the collector is embedded. In a conventional method for forming an anode assembly, two lithium pre-cut elements are positioned on opposite sides of an anode current collector. An insulated portion of the anode current collector which insulates the collector from the cathodic container is also typically positioned between the two lithium elements. The subassembly is then placed within two mold sections and is pressed together with a suitable force. The current collector and the insulator portion are sealed between the two lithium elements with a portion of the current collector (i.e., the lead) extending from the pressed together lithium elements for electrical connection of the electrochemical cell to a medical device. Conventionally, the lithium halves are roughened, e.g., brushed, to enhance cohesion between the pre-cut lithium halves. Cohesion of the lithium halves sealing the anode current collector therein is necessary to prevent the cathode material from reaching the anode current collector and rendering the electrochemical cell inoperative. As such, techniques of enhancing such cohesion are needed. In electrochemical cells, anode assemblies using lithium elements have been found to provide relatively small and efficient cells, particularly in conjunction with cathode materials, such as iodine or thionylchloride. However, costs associated with using pre-cut lithium halves to form such anode assemblies is of concern. Lithium has continuously been increasing in price as have labor costs associated with each pre-cut element. As such, there is a need for anode assembly configurations which at least hold the line on such costs. Table 1 below lists U.S. Patents that describe electrochemical cells having thin plate anodes: TABLE 1 U.S. Pat. No. Inventor(s) Issue Date 4,166,158 Mead, et al. Aug. 28, 1979 4,359,818 Zayatz Nov. 23, 1982 4,398,346 Underhill, et al. Aug. 16, 1983 4,401,736 Zayatz Aug. 30, 1983 4,421,833 Zayatz Dec. 20, 1983 4,601,962 Zayatz Jul. 22, 1986 4,812,376 Rudolph Mar. 14, 1989 4,824,744 Kuo et al. Apr. 25, 1989 5,209,994 Blattenberger et al. May 11, 1993 All patents listed in Table 1 above and elsewhere herein are hereby incorporated by reference in their respective entirety. As those of ordinary skill in the art will appreciate readily upon reading the Summary of the Invention, Detailed Description of the Embodiments and Claims set forth below, many of the devices and methods disclosed in the patents of Table 1 may be modified advantageously by using the teachings of the present invention.
//https://github.com/stephenbradshaw/vulnserver/blob/master/vulnserver.c #define _WIN32_WINNT 0x501 /* VulnServer - a deliberately vulnerable threaded TCP server application This is vulnerable software, don't run it on an important system! The author assumes no responsibility if you run this software and your system gets compromised, because this software was designed to be exploited! Visit my blog for more details: http://www.thegreycorner.com */ /* Copyright (c) 2010, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <windows.h> #include <ws2tcpip.h> #include <stdlib.h> #include <stdio.h> #define VERSION "1.00" #define DEFAULT_BUFLEN 4096 #define DEFAULT_PORT "9999" void Function1(char *Input); void Function2(char *Input); void Function3(char *Input); void Function4(char *Input); DWORD WINAPI ConnectionHandler(LPVOID CSocket); int main( int argc, char *argv[] ) { char PortNumber[6]; const char Usage[94] = "Usage: %s [port_number]\n\nIf no port number is provided, the default port of %s will be used.\n"; if ( argc > 2) { printf(Usage, argv[0], DEFAULT_PORT); return 1; } else if ( argc == 2 ) { if ( (atoi(argv[1]) > 0) && (atoi(argv[1]) < 65536) && (strlen(argv[1]) < 7) ) { strncpy(PortNumber, argv[1], 6); } else { printf(Usage, argv[0], DEFAULT_PORT); return 1; } } else { strncpy(PortNumber, DEFAULT_PORT, 6); } printf("Starting vulnserver version %s\n", VERSION); EssentialFunc1(); // Call function from external dll printf("\nThis is vulnerable software!\nDo not allow access from untrusted systems or networks!\n\n"); WSADATA wsaData; SOCKET ListenSocket = INVALID_SOCKET, ClientSocket = INVALID_SOCKET; struct addrinfo *result = NULL, hints; int Result; struct sockaddr_in ClientAddress; int ClientAddressL = sizeof(ClientAddress); Result = WSAStartup(MAKEWORD(2,2), &wsaData); if (Result != 0) { printf("WSAStartup failed with error: %d\n", Result); return 1; } ZeroMemory(&hints, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; Result = getaddrinfo(NULL, PortNumber, &hints, &result); if ( Result != 0 ) { printf("Getaddrinfo failed with error: %d\n", Result); WSACleanup(); return 1; } ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol); if (ListenSocket == INVALID_SOCKET) { printf("Socket failed with error: %ld\n", WSAGetLastError()); freeaddrinfo(result); WSACleanup(); return 1; } Result = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen); if (Result == SOCKET_ERROR) { printf("Bind failed with error: %d\n", WSAGetLastError()); closesocket(ListenSocket); WSACleanup(); return 1; } freeaddrinfo(result); Result = listen(ListenSocket, SOMAXCONN); if (Result == SOCKET_ERROR) { printf("Listen failed with error: %d\n", WSAGetLastError()); closesocket(ListenSocket); WSACleanup(); return 1; } while(ListenSocket) { printf("Waiting for client connections...\n"); ClientSocket = accept(ListenSocket, (SOCKADDR*)&ClientAddress, &ClientAddressL); if (ClientSocket == INVALID_SOCKET) { printf("Accept failed with error: %d\n", WSAGetLastError()); closesocket(ListenSocket); WSACleanup(); return 1; } printf("Received a client connection from %s:%u\n", inet_ntoa(ClientAddress.sin_addr), htons(ClientAddress.sin_port)); CreateThread(0,0,ConnectionHandler, (LPVOID)ClientSocket , 0,0); } closesocket(ListenSocket); WSACleanup(); return 0; } void Function1(char *Input) { char Buffer2S[140]; strcpy(Buffer2S, Input); } void Function2(char *Input) { char Buffer2S[60]; strcpy(Buffer2S, Input); } void Function3(char *Input) { char Buffer2S[2000]; strcpy(Buffer2S, Input); } void Function4(char *Input) { char Buffer2S[1000]; strcpy(Buffer2S, Input); } DWORD WINAPI ConnectionHandler(LPVOID CSocket) { int RecvBufLen = DEFAULT_BUFLEN; char *RecvBuf = malloc(DEFAULT_BUFLEN); char BigEmpty[1000]; char *GdogBuf = malloc(1024); int Result, SendResult, i, k; memset(BigEmpty, 0, 1000); memset(RecvBuf, 0, DEFAULT_BUFLEN); SOCKET Client = (SOCKET)CSocket; SendResult = send( Client, "Welcome to Vulnerable Server! Enter HELP for help.\n", 51, 0 ); if (SendResult == SOCKET_ERROR) { printf("Send failed with error: %d\n", WSAGetLastError()); closesocket(Client); return 1; } while (CSocket) { Result = recv(Client, RecvBuf, RecvBufLen, 0); if (Result > 0) { if (strncmp(RecvBuf, "HELP ", 5) == 0) { const char NotImplemented[47] = "Command specific help has not been implemented\n"; SendResult = send( Client, NotImplemented, sizeof(NotImplemented), 0 ); } else if (strncmp(RecvBuf, "HELP", 4) == 0) { const char ValidCommands[251] = "Valid Commands:\nHELP\nSTATS [stat_value]\nRTIME [rtime_value]\nLTIME [ltime_value]\nSRUN [srun_value]\nTRUN [trun_value]\nGMON [gmon_value]\nGDOG [gdog_value]\nKSTET [kstet_value]\nGTER [gter_value]\nHTER [hter_value]\nLTER [lter_value]\nKSTAN [lstan_value]\nEXIT\n"; SendResult = send( Client, ValidCommands, sizeof(ValidCommands), 0 ); } else if (strncmp(RecvBuf, "STATS ", 6) == 0) { char *StatBuf = malloc(120); memset(StatBuf, 0, 120); strncpy(StatBuf, RecvBuf, 120); SendResult = send( Client, "STATS VALUE NORMAL\n", 19, 0 ); } else if (strncmp(RecvBuf, "RTIME ", 6) == 0) { char *RtimeBuf = malloc(120); memset(RtimeBuf, 0, 120); strncpy(RtimeBuf, RecvBuf, 120); SendResult = send( Client, "RTIME VALUE WITHIN LIMITS\n", 26, 0 ); } else if (strncmp(RecvBuf, "LTIME ", 6) == 0) { char *LtimeBuf = malloc(120); memset(LtimeBuf, 0, 120); strncpy(LtimeBuf, RecvBuf, 120); SendResult = send( Client, "LTIME VALUE HIGH, BUT OK\n", 25, 0 ); } else if (strncmp(RecvBuf, "SRUN ", 5) == 0) { char *SrunBuf = malloc(120); memset(SrunBuf, 0, 120); strncpy(SrunBuf, RecvBuf, 120); SendResult = send( Client, "SRUN COMPLETE\n", 14, 0 ); } else if (strncmp(RecvBuf, "TRUN ", 5) == 0) { char *TrunBuf = malloc(3000); memset(TrunBuf, 0, 3000); for (i = 5; i < RecvBufLen; i++) { if ((char)RecvBuf[i] == '.') { strncpy(TrunBuf, RecvBuf, 3000); Function3(TrunBuf); break; } } memset(TrunBuf, 0, 3000); SendResult = send( Client, "TRUN COMPLETE\n", 14, 0 ); } else if (strncmp(RecvBuf, "GMON ", 5) == 0) { char GmonStatus[13] = "GMON STARTED\n"; for (i = 5; i < RecvBufLen; i++) { if ((char)RecvBuf[i] == '/') { if (strlen(RecvBuf) > 3950) { Function3(RecvBuf); } break; } } SendResult = send( Client, GmonStatus, sizeof(GmonStatus), 0 ); } else if (strncmp(RecvBuf, "GDOG ", 5) == 0) { strncpy(GdogBuf, RecvBuf, 1024); SendResult = send( Client, "GDOG RUNNING\n", 13, 0 ); } else if (strncmp(RecvBuf, "KSTET ", 6) == 0) { char *KstetBuf = malloc(100); strncpy(KstetBuf, RecvBuf, 100); memset(RecvBuf, 0, DEFAULT_BUFLEN); Function2(KstetBuf); SendResult = send( Client, "KSTET SUCCESSFUL\n", 17, 0 ); } else if (strncmp(RecvBuf, "GTER ", 5) == 0) { char *GterBuf = malloc(180); memset(GdogBuf, 0, 1024); strncpy(GterBuf, RecvBuf, 180); memset(RecvBuf, 0, DEFAULT_BUFLEN); Function1(GterBuf); SendResult = send( Client, "GTER ON TRACK\n", 14, 0 ); } else if (strncmp(RecvBuf, "HTER ", 5) == 0) { char THBuf[3]; memset(THBuf, 0, 3); char *HterBuf = malloc((DEFAULT_BUFLEN+1)/2); memset(HterBuf, 0, (DEFAULT_BUFLEN+1)/2); i = 6; k = 0; while ( (RecvBuf[i]) && (RecvBuf[i+1])) { memcpy(THBuf, (char *)RecvBuf+i, 2); unsigned long j = strtoul((char *)THBuf, NULL, 16); memset((char *)HterBuf + k, (byte)j, 1); i = i + 2; k++; } Function4(HterBuf); memset(HterBuf, 0, (DEFAULT_BUFLEN+1)/2); SendResult = send( Client, "HTER RUNNING FINE\n", 18, 0 ); } else if (strncmp(RecvBuf, "LTER ", 5) == 0) { char *LterBuf = malloc(DEFAULT_BUFLEN); memset(LterBuf, 0, DEFAULT_BUFLEN); i = 0; while(RecvBuf[i]) { if ((byte)RecvBuf[i] > 0x7f) { LterBuf[i] = (byte)RecvBuf[i] - 0x7f; } else { LterBuf[i] = RecvBuf[i]; } i++; } for (i = 5; i < DEFAULT_BUFLEN; i++) { if ((char)LterBuf[i] == '.') { Function3(LterBuf); break; } } memset(LterBuf, 0, DEFAULT_BUFLEN); SendResult = send( Client, "LTER COMPLETE\n", 14, 0 ); } else if (strncmp(RecvBuf, "KSTAN ", 6) == 0) { SendResult = send( Client, "KSTAN UNDERWAY\n", 15, 0 ); } else if (strncmp(RecvBuf, "EXIT", 4) == 0) { SendResult = send( Client, "GOODBYE\n", 8, 0 ); printf("Connection closing...\n"); closesocket(Client); return 0; } else { SendResult = send( Client, "UNKNOWN COMMAND\n", 16, 0 ); } if (SendResult == SOCKET_ERROR) { printf("Send failed with error: %d\n", WSAGetLastError()); closesocket(Client); return 1; } } else if (Result == 0) { printf("Connection closing...\n"); closesocket(Client); return 0; } else { printf("Recv failed with error: %d\n", WSAGetLastError()); closesocket(Client); return 1; } } }
Identification of highly specific antibodies for Serine/threonine-protein kinase TBK1 for use in immunoblot, immunoprecipitation and immunofluorescence. TBK1 is a serine-threonine protein kinase that has been linked to a number of diseases including amyotrophic lateral sclerosis and frontotemporal dementia. Reproducible research on TBK1 has been hampered by the lack of well characterized antibodies. In this study, we characterized 11 commercial antibodies for TBK1 for use in immunoblot, immunofluorescence and immunoprecipitation, using an isogeneic knock-out cell line as a control. We identify antibodies that appear specific for all three applications but invite the readers to interpret the present findings based on their own scientific expertise and use this report as a guide to select the most appropriate antibody for their specific needs.
NBC has announced that it will premiere “For Love or Money,” a new and unscripted drama series in which 15 beautiful women compete for one lucky man, on Monday, June 2. The special two-hour premiere will air 9-11 p.m. ET, with the series airing in its regular time slot -- 9-10 p.m. ET -- beginning Monday, June 9. An "unexpected turn of events" in the fourth episode will take the series to a whole new level as the stakes become higher for all the participants. In the final episode, the bachelor will make his choice - and the winning contestant will make hers - decisions that could affect both of their lives forever. During the course of events, the show will feature romantic private dates in California’s Santa Barbara, Napa Valley, San Diego, Malibu and Catalina Island, as well as in Telluride, Colorado. The series, which recently completed filming, also was shot in Bel Air, California and Dallas, Texas. “For Love or Money” is a production of Nash Entertainment & 3 Ball Productions. Bruce Nash (NBC’s “Meet My Folks,” “Mr. Personality”) is the executive producer, along with J.D. Roth (“Endurance,” “Moolah Beach”), Todd Nelson (“Endurance,” “Moolah Beach”) and John Foy (“The Martin Short Show”).
Identification of oral carcinogenesis using autofluorescence spectroscopy: an in-vivo study A study on in vivo measurement of autofluorescence spectra for hamster buccal pouch and development of oral carcinogenesis identification algorithm is presented. The measurement was preceded with a fiber-optics based fluorescence spectroscopy system. In total 75 samples, including 14 hyperkratosis, 23 normal, 28 dysplasia, and 10 SCC, were separated into 4 categories. All the spectra were normalized to have the same area below the spectrum curve. The results show that the autofluorescence spectra start to change as soon as the tissues have morphological alternation (eg hyperkratosis). The differences of ratios between the areas under 380+/- 15 nm and 460+/- 15 nm (denoted as A380+/- 15/ A460+/- 15) among categories are statistically significant. To develop a diagnostic algorithm for early neoplasia detection and evaluate its performance, a PLS discriminant analysis with cross-validation technique was proceeded. Sample points on the PLS score plot were grouped as four categories. By selecting suitable threshold, the accuracy rates for classifying 4 categories of samples are 86% (hyperkratosis), 87% (normal), 90% (dysplasia), and 100% (SCC), respectively. The results reveal that the autofluorescence spectroscopy technique is potential for in vivo detection of early neoplasia of oral tissues.
An intelligent active-passive vibration absorber using hierarchical fuzzy approach It has been shown that piezoelectric materials can be used as highly promising for application such as passive electromechanical vibration absorbers by shunting them with electrical networks. However, these passive devices have limitations that restrict their practical applications. The main goal of this work is to develop a novel approach for achieving a high performance adaptive piezoelectric absorber - an active-passive hybrid configuration. Owing to the adaptive capability of fuzzy inference systems, its applications to the active control are immediate. This investigation addresses the first application of the concept of hierarchy for controlling fuzzy systems in such an active-passive absorber. One of the main advantages of using a hierarchical fuzzy system is to minimize the size of the rule base by eliminating "the curse of dimensionality". Although the performance of the optimal passive absorber is already much better than the original system (no absorber), the intelligent active-passive absorber can still outperform the passive system significantly. The fuzzy control method appears quite useful as regards reliability and robustness.
package regources type RequestsCount struct { Approved int64 `json:"approved"` Pending int64 `json:"pending"` }
Characterization and chromosomal localization of the human proto-oncogene BMI-1. The proto-oncogene bmi-1 is frequently activated by Moloney murine leukemia proviral insertions in E mu-myc transgenic mice1,2. Using a mouse bmi-1 cDNA probe a transcript of 3.3 kb was detected on Northern blots of human Burkitt's lymphoma cell lines. We have isolated and sequenced cDNA clones from a human erythroleukemia cell line (K562) derived cDNA library, using different mouse bmi-1 cDNA fragments as a probe. Analysis of genomic BMI-1 sequences reveals a gene structure which is very similar to that of the mouse, consisting of at least 10 exons. The human cDNA is 3203 bp in length and shows 86% identity to the mouse nucleotide sequence. The open reading frame encodes a protein of 326 amino acids which shares 98% identity to the amino acid sequence of mouse bmi-1 protein. In vitro translation experiments show that human cDNA derived RNA translates into a protein with a mobility of 44-46 kD on SDS polyacrylamide gels. Fluorescence in situ hybridization (FISH) on metaphase chromosome spreads located the human BMI-1 gene to the short arm of chromosome 10 (10p13), a region known to be involved in translocations in various leukemias.
import { MetadataBearer as $MetadataBearer, SmithyException as __SmithyException } from "../../types/mod.ts"; /** * <p>A timestamp, and a single numerical value, which together represent a measurement at a particular point in time.</p> */ export interface DataPoint { /** * <p>The time, in epoch format, associated with a particular <code>Value</code>.</p> */ Timestamp: Date | undefined; /** * <p>The actual value associated with a particular <code>Timestamp</code>.</p> */ Value: number | undefined; } export namespace DataPoint { /** * @internal */ export const filterSensitiveLog = (obj: DataPoint): any => ({ ...obj, }); } /** * <p>A logical grouping of Performance Insights metrics for a related subject area. For example, the * <code>db.sql</code> dimension group consists of the following dimensions: * <code>db.sql.id</code>, <code>db.sql.db_id</code>, <code>db.sql.statement</code>, and * <code>db.sql.tokenized_id</code>.</p> * <note> * <p>Each response element returns a maximum of 500 bytes. For larger elements, such as SQL statements, * only the first 500 bytes are returned.</p> * </note> */ export interface DimensionGroup { /** * <p>The name of the dimension group. Valid values are:</p> * * <ul> * <li> * <p> * <code>db</code> - The name of the database to which the client is connected (only Aurora PostgreSQL, RDS * PostgreSQL, Aurora MySQL, RDS MySQL, and MariaDB)</p> * </li> * <li> * <p> * <code>db.application</code> - The name of the application that is connected to the database (only Aurora * PostgreSQL and RDS PostgreSQL)</p> * </li> * <li> * <p> * <code>db.host</code> - The host name of the connected client (all engines)</p> * </li> * <li> * <p> * <code>db.session_type</code> - The type of the current session (only Aurora PostgreSQL and RDS PostgreSQL)</p> * </li> * <li> * <p> * <code>db.sql</code> - The SQL that is currently executing (all engines)</p> * </li> * <li> * <p> * <code>db.sql_tokenized</code> - The SQL digest (all engines)</p> * </li> * <li> * <p> * <code>db.wait_event</code> - The event for which the database backend is waiting (all engines)</p> * </li> * <li> * <p> * <code>db.wait_event_type</code> - The type of event for which the database backend is waiting (all engines)</p> * </li> * <li> * <p> * <code>db.user</code> - The user logged in to the database (all engines)</p> * </li> * </ul> */ Group: string | undefined; /** * <p>A list of specific dimensions from a dimension group. If this parameter is not present, * then it signifies that all of the dimensions in the group were requested, or are present in * the response.</p> * <p>Valid values for elements in the <code>Dimensions</code> array are:</p> * * <ul> * <li> * <p> * <code>db.application.name</code> - The name of the application that is connected to the database (only * Aurora PostgreSQL and RDS PostgreSQL)</p> * </li> * <li> * <p> * <code>db.host.id</code> - The host ID of the connected client (all engines)</p> * </li> * <li> * <p> * <code>db.host.name</code> - The host name of the connected client (all engines)</p> * </li> * <li> * <p> * <code>db.name</code> - The name of the database to which the client is connected (only Aurora * PostgreSQL, RDS PostgreSQL, Aurora MySQL, RDS MySQL, and MariaDB)</p> * </li> * <li> * <p> * <code>db.session_type.name</code> - The type of the current session (only Aurora PostgreSQL and RDS PostgreSQL)</p> * </li> * <li> * <p> * <code>db.sql.id</code> - The SQL ID generated by Performance Insights (all engines)</p> * </li> * <li> * <p> * <code>db.sql.db_id</code> - The SQL ID generated by the database (all engines)</p> * </li> * <li> * <p> * <code>db.sql.statement</code> - The SQL text that is being executed (all engines)</p> * </li> * <li> * <p> * <code>db.sql.tokenized_id</code> * </p> * </li> * <li> * <p> * <code>db.sql_tokenized.id</code> - The SQL digest ID generated by Performance Insights (all engines)</p> * </li> * <li> * <p> * <code>db.sql_tokenized.db_id</code> - SQL digest ID generated by the database (all engines)</p> * </li> * <li> * <p> * <code>db.sql_tokenized.statement</code> - The SQL digest text (all engines)</p> * </li> * <li> * <p> * <code>db.user.id</code> - The ID of the user logged in to the database (all engines)</p> * </li> * <li> * <p> * <code>db.user.name</code> - The name of the user logged in to the database (all engines)</p> * </li> * <li> * <p> * <code>db.wait_event.name</code> - The event for which the backend is waiting (all engines)</p> * </li> * <li> * <p> * <code>db.wait_event.type</code> - The type of event for which the backend is waiting (all engines)</p> * </li> * <li> * <p> * <code>db.wait_event_type.name</code> - The name of the event type for which the backend is waiting (all * engines)</p> * </li> * </ul> */ Dimensions?: string[]; /** * <p>The maximum number of items to fetch for this dimension group.</p> */ Limit?: number; } export namespace DimensionGroup { /** * @internal */ export const filterSensitiveLog = (obj: DimensionGroup): any => ({ ...obj, }); } export enum ServiceType { RDS = "RDS", } export interface DescribeDimensionKeysRequest { /** * <p>The AWS service for which Performance Insights will return metrics. The only valid value for <i>ServiceType</i> is * <code>RDS</code>.</p> */ ServiceType: ServiceType | string | undefined; /** * <p>An immutable, AWS Region-unique identifier for a data source. Performance Insights gathers metrics from * this data source.</p> * <p>To use an Amazon RDS instance as a data source, you specify its <code>DbiResourceId</code> value. For example, * specify <code>db-FAIHNTYBKTGAUSUZQYPDS2GW4A</code> * </p> */ Identifier: string | undefined; /** * <p>The date and time specifying the beginning of the requested time series data. You must specify a * <code>StartTime</code> within the past 7 days. The value specified is <i>inclusive</i>, which means * that data points equal to or greater than <code>StartTime</code> are returned.</p> * <p>The value for <code>StartTime</code> must be earlier than the value for * <code>EndTime</code>.</p> */ StartTime: Date | undefined; /** * <p>The date and time specifying the end of the requested time series data. The value specified is * <i>exclusive</i>, which means that data points less than (but not equal to) <code>EndTime</code> are * returned.</p> * <p>The value for <code>EndTime</code> must be later than the value for * <code>StartTime</code>.</p> */ EndTime: Date | undefined; /** * <p>The name of a Performance Insights metric to be measured.</p> * <p>Valid values for <code>Metric</code> are:</p> * * <ul> * <li> * <p> * <code>db.load.avg</code> - a scaled representation of the number of active sessions * for the database engine.</p> * </li> * <li> * <p> * <code>db.sampledload.avg</code> - the raw number of active sessions for the * database engine.</p> * </li> * </ul> * <p>If the number of active sessions is less than an internal Performance Insights threshold, <code>db.load.avg</code> and <code>db.sampledload.avg</code> * are the same value. If the number of active sessions is greater than the internal threshold, Performance Insights samples the active sessions, with <code>db.load.avg</code> * showing the scaled values, <code>db.sampledload.avg</code> showing the raw values, and <code>db.sampledload.avg</code> less than <code>db.load.avg</code>. * For most use cases, you can query <code>db.load.avg</code> only. </p> */ Metric: string | undefined; /** * <p>The granularity, in seconds, of the data points returned from Performance Insights. A period can be as short as * one second, or as long as one day (86400 seconds). Valid values are:</p> * * <ul> * <li> * <p> * <code>1</code> (one second)</p> * </li> * <li> * <p> * <code>60</code> (one minute)</p> * </li> * <li> * <p> * <code>300</code> (five minutes)</p> * </li> * <li> * <p> * <code>3600</code> (one hour)</p> * </li> * <li> * <p> * <code>86400</code> (twenty-four hours)</p> * </li> * </ul> * * <p>If you don't specify <code>PeriodInSeconds</code>, then Performance Insights chooses a value for you, with a goal of returning * roughly 100-200 data points in the response.</p> */ PeriodInSeconds?: number; /** * <p>A specification for how to aggregate the data points from a query result. You must specify a valid dimension group. * Performance Insights returns all dimensions within this group, unless you provide the names of specific dimensions within this group. * You can also request that Performance Insights return a limited number of values for a dimension.</p> */ GroupBy: DimensionGroup | undefined; /** * <p>For each dimension specified in * <code>GroupBy</code>, specify a secondary dimension to further subdivide the partition keys in the response.</p> */ PartitionBy?: DimensionGroup; /** * <p>One or more filters to apply in the request. Restrictions:</p> * <ul> * <li> * <p>Any number of filters by the same dimension, as specified in the <code>GroupBy</code> or * <code>Partition</code> parameters.</p> * </li> * <li> * <p>A single filter for any other dimension in this dimension group.</p> * </li> * </ul> */ Filter?: { [key: string]: string }; /** * <p>The maximum number of items to return in the response. * If more items exist than the specified <code>MaxRecords</code> value, a pagination * token is included in the response so that the remaining * results can be retrieved. * </p> */ MaxResults?: number; /** * <p>An optional pagination token provided by a previous request. If * this parameter is specified, the response includes only records beyond the token, up to the * value specified by <code>MaxRecords</code>.</p> */ NextToken?: string; } export namespace DescribeDimensionKeysRequest { /** * @internal */ export const filterSensitiveLog = (obj: DescribeDimensionKeysRequest): any => ({ ...obj, }); } /** * <p>An array of descriptions and aggregated values for * each dimension within a dimension group.</p> */ export interface DimensionKeyDescription { /** * <p>A map of name-value pairs for the dimensions in the group.</p> */ Dimensions?: { [key: string]: string }; /** * <p>The aggregated metric value for the dimension(s), over the requested time range.</p> */ Total?: number; /** * <p>If <code>PartitionBy</code> was specified, <code>PartitionKeys</code> contains the dimensions that were.</p> */ Partitions?: number[]; } export namespace DimensionKeyDescription { /** * @internal */ export const filterSensitiveLog = (obj: DimensionKeyDescription): any => ({ ...obj, }); } /** * <p>If <code>PartitionBy</code> was specified in a <code>DescribeDimensionKeys</code> * request, the dimensions are returned in an array. Each element in the array specifies one * dimension. </p> */ export interface ResponsePartitionKey { /** * <p>A dimension map that contains the dimension(s) for this partition.</p> */ Dimensions: { [key: string]: string } | undefined; } export namespace ResponsePartitionKey { /** * @internal */ export const filterSensitiveLog = (obj: ResponsePartitionKey): any => ({ ...obj, }); } export interface DescribeDimensionKeysResponse { /** * <p>The start time for the returned dimension keys, after alignment to a granular boundary (as * specified by <code>PeriodInSeconds</code>). <code>AlignedStartTime</code> will be less than or * equal to the value of the user-specified <code>StartTime</code>.</p> */ AlignedStartTime?: Date; /** * <p>The end time for the returned dimension keys, after alignment to a granular boundary (as * specified by <code>PeriodInSeconds</code>). <code>AlignedEndTime</code> will be greater than * or equal to the value of the user-specified <code>Endtime</code>.</p> */ AlignedEndTime?: Date; /** * <p>If <code>PartitionBy</code> was present in the request, <code>PartitionKeys</code> contains the breakdown of dimension keys by the specified partitions.</p> */ PartitionKeys?: ResponsePartitionKey[]; /** * <p>The dimension keys that were requested.</p> */ Keys?: DimensionKeyDescription[]; /** * <p>An optional pagination token provided by a previous request. If * this parameter is specified, the response includes only records beyond the token, up to the * value specified by <code>MaxRecords</code>.</p> */ NextToken?: string; } export namespace DescribeDimensionKeysResponse { /** * @internal */ export const filterSensitiveLog = (obj: DescribeDimensionKeysResponse): any => ({ ...obj, }); } /** * <p>The request failed due to an unknown error.</p> */ export interface InternalServiceError extends __SmithyException, $MetadataBearer { name: "InternalServiceError"; $fault: "server"; Message?: string; } export namespace InternalServiceError { /** * @internal */ export const filterSensitiveLog = (obj: InternalServiceError): any => ({ ...obj, }); } /** * <p>One of the arguments provided is invalid for this request.</p> */ export interface InvalidArgumentException extends __SmithyException, $MetadataBearer { name: "InvalidArgumentException"; $fault: "client"; Message?: string; } export namespace InvalidArgumentException { /** * @internal */ export const filterSensitiveLog = (obj: InvalidArgumentException): any => ({ ...obj, }); } /** * <p>The user is not authorized to perform this request.</p> */ export interface NotAuthorizedException extends __SmithyException, $MetadataBearer { name: "NotAuthorizedException"; $fault: "client"; Message?: string; } export namespace NotAuthorizedException { /** * @internal */ export const filterSensitiveLog = (obj: NotAuthorizedException): any => ({ ...obj, }); } export enum DetailStatus { AVAILABLE = "AVAILABLE", PROCESSING = "PROCESSING", UNAVAILABLE = "UNAVAILABLE", } /** * <p>An object that describes the details for a specified dimension.</p> */ export interface DimensionKeyDetail { /** * <p>The value of the dimension detail data. For the <code>db.sql.statement</code> dimension, this value is either the * full or truncated SQL query, depending on the return status.</p> */ Value?: string; /** * <p>The full name of the dimension. The full name includes the group name and key name. The only valid value is * <code>db.sql.statement</code>. </p> */ Dimension?: string; /** * <p>The status of the dimension detail data. Possible values include the following:</p> * <ul> * <li> * <p> * <code>AVAILABLE</code> - The dimension detail data is ready to be retrieved.</p> * </li> * <li> * <p> * <code>PROCESSING</code> - The dimension detail data isn't ready to be retrieved because more processing time is * required. If the requested detail data for <code>db.sql.statement</code> has the status <code>PROCESSING</code>, * Performance Insights returns the truncated query.</p> * </li> * <li> * <p> * <code>UNAVAILABLE</code> - The dimension detail data could not be collected successfully.</p> * </li> * </ul> */ Status?: DetailStatus | string; } export namespace DimensionKeyDetail { /** * @internal */ export const filterSensitiveLog = (obj: DimensionKeyDetail): any => ({ ...obj, }); } export interface GetDimensionKeyDetailsRequest { /** * <p>The AWS service for which Performance Insights returns data. The only valid value is <code>RDS</code>.</p> */ ServiceType: ServiceType | string | undefined; /** * <p>The ID for a data source from which to gather dimension data. This ID must be immutable and unique within an AWS * Region. When a DB instance is the data source, specify its <code>DbiResourceId</code> value. For example, specify * <code>db-ABCDEFGHIJKLMNOPQRSTU1VW2X</code>. </p> */ Identifier: string | undefined; /** * <p>The name of the dimension group. The only valid value is <code>db.sql</code>. Performance Insights searches the * specified group for the dimension group ID.</p> */ Group: string | undefined; /** * <p>The ID of the dimension group from which to retrieve dimension details. For dimension group <code>db.sql</code>, * the group ID is <code>db.sql.id</code>.</p> */ GroupIdentifier: string | undefined; /** * <p>A list of dimensions to retrieve the detail data for within the given dimension group. For the dimension group * <code>db.sql</code>, specify either the full dimension name <code>db.sql.statement</code> or the short * dimension name <code>statement</code>. If you don't specify this parameter, Performance Insights returns all * dimension data within the specified dimension group.</p> */ RequestedDimensions?: string[]; } export namespace GetDimensionKeyDetailsRequest { /** * @internal */ export const filterSensitiveLog = (obj: GetDimensionKeyDetailsRequest): any => ({ ...obj, }); } export interface GetDimensionKeyDetailsResponse { /** * <p>The details for the requested dimensions.</p> */ Dimensions?: DimensionKeyDetail[]; } export namespace GetDimensionKeyDetailsResponse { /** * @internal */ export const filterSensitiveLog = (obj: GetDimensionKeyDetailsResponse): any => ({ ...obj, }); } /** * <p>A single query to be processed. You must provide the metric to query. If no other * parameters are specified, Performance Insights returns all of the data points for that metric. You can * optionally request that the data points be aggregated by dimension group ( * <code>GroupBy</code>), and return only those data points that match your criteria (<code>Filter</code>).</p> */ export interface MetricQuery { /** * <p>The name of a Performance Insights metric to be measured.</p> * <p>Valid values for <code>Metric</code> are:</p> * * <ul> * <li> * <p> * <code>db.load.avg</code> - a scaled representation of the number of active sessions * for the database engine.</p> * </li> * <li> * <p> * <code>db.sampledload.avg</code> - the raw number of active sessions for the * database engine.</p> * </li> * </ul> * <p>If the number of active sessions is less than an internal Performance Insights threshold, <code>db.load.avg</code> and <code>db.sampledload.avg</code> * are the same value. If the number of active sessions is greater than the internal threshold, Performance Insights samples the active sessions, with <code>db.load.avg</code> * showing the scaled values, <code>db.sampledload.avg</code> showing the raw values, and <code>db.sampledload.avg</code> less than <code>db.load.avg</code>. * For most use cases, you can query <code>db.load.avg</code> only. </p> */ Metric: string | undefined; /** * <p>A specification for how to aggregate the data points from a query result. You must * specify a valid dimension group. Performance Insights will return all of the dimensions within that group, * unless you provide the names of specific dimensions within that group. You can also request * that Performance Insights return a limited number of values for a dimension.</p> */ GroupBy?: DimensionGroup; /** * <p>One or more filters to apply in the request. Restrictions:</p> * <ul> * <li> * <p>Any number of filters by the same dimension, as specified in the <code>GroupBy</code> parameter.</p> * </li> * <li> * <p>A single filter for any other dimension in this dimension group.</p> * </li> * </ul> */ Filter?: { [key: string]: string }; } export namespace MetricQuery { /** * @internal */ export const filterSensitiveLog = (obj: MetricQuery): any => ({ ...obj, }); } export interface GetResourceMetricsRequest { /** * <p>The AWS service for which Performance Insights returns metrics. The only valid value for <i>ServiceType</i> is * <code>RDS</code>.</p> */ ServiceType: ServiceType | string | undefined; /** * <p>An immutable, AWS Region-unique identifier for a data source. Performance Insights gathers metrics from * this data source.</p> * <p>To use a DB instance as a data source, specify its <code>DbiResourceId</code> value. For example, specify * <code>db-FAIHNTYBKTGAUSUZQYPDS2GW4A</code>.</p> */ Identifier: string | undefined; /** * <p>An array of one or more queries to perform. Each query must specify a Performance Insights metric, and * can optionally specify aggregation and filtering criteria.</p> */ MetricQueries: MetricQuery[] | undefined; /** * <p>The date and time specifying the beginning of the requested time series data. You can't * specify a <code>StartTime</code> that's earlier than 7 days ago. The value specified is * <i>inclusive</i> - data points equal to or greater than <code>StartTime</code> * will be returned.</p> * <p>The value for <code>StartTime</code> must be earlier than the value for <code>EndTime</code>.</p> */ StartTime: Date | undefined; /** * <p>The date and time specifying the end of the requested time series data. The value specified is * <i>exclusive</i> - data points less than (but not equal to) <code>EndTime</code> will be returned.</p> * <p>The value for <code>EndTime</code> must be later than the value for <code>StartTime</code>.</p> */ EndTime: Date | undefined; /** * <p>The granularity, in seconds, of the data points returned from Performance Insights. A period can be as short as * one second, or as long as one day (86400 seconds). Valid values are:</p> * * <ul> * <li> * <p> * <code>1</code> (one second)</p> * </li> * <li> * <p> * <code>60</code> (one minute)</p> * </li> * <li> * <p> * <code>300</code> (five minutes)</p> * </li> * <li> * <p> * <code>3600</code> (one hour)</p> * </li> * <li> * <p> * <code>86400</code> (twenty-four hours)</p> * </li> * </ul> * * <p>If you don't specify <code>PeriodInSeconds</code>, then Performance Insights will choose a value for * you, with a goal of returning roughly 100-200 data points in the response.</p> */ PeriodInSeconds?: number; /** * <p>The maximum number of items to return in the response. * If more items exist than the specified <code>MaxRecords</code> value, a pagination * token is included in the response so that the remaining * results can be retrieved. * </p> */ MaxResults?: number; /** * <p>An optional pagination token provided by a previous request. If * this parameter is specified, the response includes only records beyond the token, up to the * value specified by <code>MaxRecords</code>.</p> */ NextToken?: string; } export namespace GetResourceMetricsRequest { /** * @internal */ export const filterSensitiveLog = (obj: GetResourceMetricsRequest): any => ({ ...obj, }); } /** * <p>An object describing a Performance Insights metric and one or more dimensions for that metric.</p> */ export interface ResponseResourceMetricKey { /** * <p>The name of a Performance Insights metric to be measured.</p> * <p>Valid values for <code>Metric</code> are:</p> * * <ul> * <li> * <p> * <code>db.load.avg</code> - a scaled representation of the number of active sessions * for the database engine.</p> * </li> * <li> * <p> * <code>db.sampledload.avg</code> - the raw number of active sessions for the * database engine.</p> * </li> * </ul> * <p>If the number of active sessions is less than an internal Performance Insights threshold, <code>db.load.avg</code> and <code>db.sampledload.avg</code> * are the same value. If the number of active sessions is greater than the internal threshold, Performance Insights samples the active sessions, with <code>db.load.avg</code> * showing the scaled values, <code>db.sampledload.avg</code> showing the raw values, and <code>db.sampledload.avg</code> less than <code>db.load.avg</code>. * For most use cases, you can query <code>db.load.avg</code> only. </p> */ Metric: string | undefined; /** * <p>The valid dimensions for the metric.</p> */ Dimensions?: { [key: string]: string }; } export namespace ResponseResourceMetricKey { /** * @internal */ export const filterSensitiveLog = (obj: ResponseResourceMetricKey): any => ({ ...obj, }); } /** * <p>A time-ordered series of data points, corresponding to a dimension of a Performance Insights * metric.</p> */ export interface MetricKeyDataPoints { /** * <p>The dimension(s) to which the data points apply.</p> */ Key?: ResponseResourceMetricKey; /** * <p>An array of timestamp-value pairs, representing measurements over a period of time.</p> */ DataPoints?: DataPoint[]; } export namespace MetricKeyDataPoints { /** * @internal */ export const filterSensitiveLog = (obj: MetricKeyDataPoints): any => ({ ...obj, }); } export interface GetResourceMetricsResponse { /** * <p>The start time for the returned metrics, after alignment to a granular boundary (as * specified by <code>PeriodInSeconds</code>). <code>AlignedStartTime</code> will be less than or * equal to the value of the user-specified <code>StartTime</code>.</p> */ AlignedStartTime?: Date; /** * <p>The end time for the returned metrics, after alignment to a granular boundary (as * specified by <code>PeriodInSeconds</code>). <code>AlignedEndTime</code> will be greater than * or equal to the value of the user-specified <code>Endtime</code>.</p> */ AlignedEndTime?: Date; /** * <p>An immutable, AWS Region-unique identifier for a data source. Performance Insights gathers metrics from * this data source.</p> * <p>To use a DB instance as a data source, you specify its * <code>DbiResourceId</code> value - for example: * <code>db-FAIHNTYBKTGAUSUZQYPDS2GW4A</code> * </p> */ Identifier?: string; /** * <p>An array of metric results,, where each array element contains all of the data points for a particular dimension.</p> */ MetricList?: MetricKeyDataPoints[]; /** * <p>An optional pagination token provided by a previous request. If * this parameter is specified, the response includes only records beyond the token, up to the * value specified by <code>MaxRecords</code>.</p> */ NextToken?: string; } export namespace GetResourceMetricsResponse { /** * @internal */ export const filterSensitiveLog = (obj: GetResourceMetricsResponse): any => ({ ...obj, }); }
<filename>Arduino/Dev/ArduBlock/openblocks/src/main/java/edu/mit/blocks/codeblockutil/CProgressBar.java package edu.mit.blocks.codeblockutil; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingConstants; import javax.swing.Timer; public class CProgressBar extends JFrame implements ActionListener { private static final long serialVersionUID = 328149080260L; JProgressBar bar; Timer timer; public CProgressBar(String text) { super(text); this.setUndecorated(true); this.setAlwaysOnTop(true); this.setBounds(300, 400, 400, 40); this.setLayout(new BorderLayout()); JPanel pane = new JPanel(new BorderLayout()); pane.setBorder(BorderFactory.createMatteBorder(3, 3, 3, 3, Color.blue)); JLabel label = new JLabel(text, SwingConstants.CENTER); label.setFont(new Font("Ariel", Font.BOLD, 12)); pane.add(label, BorderLayout.NORTH); bar = new JProgressBar(0, 100); //bar.setStringPainted(true); pane.add(bar, BorderLayout.CENTER); this.add(pane, BorderLayout.CENTER); timer = new Timer(750, this); this.setVisible(true); timer.start(); } @Override public void actionPerformed(ActionEvent e) { if (bar.getValue() > bar.getMaximum() * 0.75) { this.setVisible(false); this.dispose(); timer.stop(); } else { bar.setValue(bar.getValue() * 2 + 1); } } }
Cognitive Coping vs Emotional Disclosure in the Treatment of Anxious Children: A Pilot-Study The present pilot-study was a first attempt to examine the effectiveness of the cognitive component of cognitive behaviour therapy for children with anxiety problems. A total of 24 highly anxious children were assigned to 1 of 2 intervention conditions: a Cognitive Coping intervention, which focussed primarily on the cognitive component of cognitive behaviour therapy, or an Emotional Disclosure intervention in which children were invited to write about their fears and anxious experiences. Children completed self-report questionnaires of anxiety disorders symptoms and worry at 3 points in time: (i) 6 weeks before treatment (i.e. baseline), (ii) at pre-treatment, and (iii) at post-treatment. The results showed, firstly, that levels of anxiety disorder symptoms and worry remained relatively stable over a 6-week waiting period and then decreased substantially after the interventions. This suggests that the children did not suffer from momentary anxiety and worry complaints and that treatments generally were effective in reducing these symptoms. Secondly, although within-group comparisons suggested that treatment effects were somewhat larger in the Cognitive Coping condition than in the Emotional Disclosure condition (effects sizes for anxiety disorders symptoms and worry were, respectively, 1.03 and 0.87 for Cognitive Coping vs 0.54 and 0.39 for Emotional Disclosure), statistical tests could not substantiate this impression, probably due to a lack of power as a result of the small numbers of children in both intervention conditions.
Airfoil Speakers Touch does one thing, and it does it well. The iPhone application receives audio wirelessly from your computer and plays it either through its built-in speakers or via the headphone jack. To owners of Apple Airport Express users, this might seem familiar. That’s because it is. Essentially, this application turns your iPhone or iPod Touch into an Airport Express. I’m a heavy user of Apple’s Airtunes, the magic which lets me stream music to multiple speakers around the house. I have a couple of airport express units hooked up and either I or the Lady can send tunes to them. The trouble is, this only works with iTunes. Get your music from anywhere else and you’re back to running cables. You can control the volume using the on-screen slider and, if the iPod is in a dock you can use the Apple remote to control the iPod’s master volume, too. That’s it for controls, and that’s where the annoyances start to creep in. If you are using the Apple Remote, make sure you don’t press anything but the volume switch. If you do, Airfoil Speakers Touch will quit and the music will start blaring from your laptop’s speakers instead. Worse, the iPod will start playing the first track in its library. This is a problem caused by Apple, not by Rogue Amoeba — all apps do this when the remote is used — but that doesn’t make it any less annoying. Next, if you usually use the Apple made Remote application for your iPhone, you can’t use it and Airfoil at the same time. Airfoil will quit out as described above. Again, annoying, but a consequence of the inability to run background processes on the iPhone. Gripes aside, Airfoil Speakers Touch is a wonderfully simple and useful little application. You can use it to hook up an extra set of speakers indoors, for instance, or send audio outside to battery-powered speakers where there is no power and, therefore no way to use an Airport Express. You can even use it to listen to a new, un-synced podcast with headphones while you cook. You, know, for example. Best of all, it’s free, although you’ll need the $25 Airfoil software to use it.
<filename>midpoint.py #!/usr/bin/python # -------------------------------------------------------------------- # midpoint.py # -------------------------------------------------------------------- """ Find a midpoint of two political districting plans by building and solving a MIP (mixed-integer (linear) program). """ import cplex from cplex.exceptions import CplexError import itertools from math import sqrt import numpy as np import pandas as pd import random import sys import traceback import xml.etree.ElementTree as ET import gerrychain import helpers import hybrid def extract_plan_constants(plan): """ Extracts the cut-edge constants (indicator vector) of the given district plan. """ edges = [e for e in plan.graph.edges()] cut_edges = plan.cut_edges is_cut_edge = np.zeros(len(edges)) for index, e in enumerate(edges): if e in cut_edges: is_cut_edge[index] = 1 return is_cut_edge def build_midpoint_milp(plan_a, plan_b, tau=0.03): """ Builds and returns a CPLEX model object representing a MILP for finding the midpoint of the given two district plans. The parameter tau is the population balance tolerance with a default value of 3%. """ model = cplex.Cplex() model.set_problem_name("midpoint_py") # Objective: minimize total moment-of-inertia (from Hess model) model.objective.set_sense(model.objective.sense.minimize) n = plan_a.graph.number_of_nodes() k = len(plan_a.parts) n_xvars = n * n edges = [e for e in plan_a.graph.edges()] a = extract_plan_constants(plan_a) b = extract_plan_constants(plan_b) D_ab = helpers.pereira_index(plan_a, plan_b) def x_varindex(i, j): return i * n + j d = np.zeros((n, n)) # Squared distances between units x = np.zeros((n,)) y = np.zeros((n,)) for v in range(n): # Distances for square grid graph are based on x,y coords x[v] = v // int(sqrt(n)) y[v] = v % int(sqrt(n)) for u in range(n): for v in range(n): d[u, v] = (x[u] - x[v])**2 + (y[u] - y[v])**2 # Create x variables. x[i, j] is 1 if and only if # unit i is assigned to a district whose center is j. colname_x = ["x{0}".format(i + 1) for i in range(n_xvars)] model.variables.add(obj=[0] * n_xvars, lb=[0] * n_xvars, # obj=list(np.reshape(d, (n**2,))) ub=[1] * n_xvars, names=colname_x, types=["N"] * n_xvars) # Create flow variables. f^v_{ij} is the amount of # (nonnegative) flow from the district centered at v (if one exists) # through edge ij. dir_edges = [] # Consider a bidirected version of the undirected graph for e in edges: dir_edges.append(e) dir_edges.append((e[1], e[0])) colname_f = ["f{0}_{1}".format(v, edge) for v, edge in itertools.product(np.arange(1, n + 1), dir_edges)] model.variables.add(obj=[0] * len(colname_f), lb=[0] * len(colname_f), names=colname_f) # Create y and z variables to represent cut-edges colname_y = ["y{0}".format(e) for e in edges] model.variables.add(obj=[0] * len(edges), lb=[0] * len(edges), ub=[1] * len(edges), names=colname_y, types=["N"] * len(edges)) def z_varindex(v, edge_index): return v * len(edges) + edge_index colname_z = [] for v in range(n): for edge_index in range(len(edges)): colname_z.append('z{0}'.format(z_varindex(v, edge_index))) model.variables.add(obj=[0] * len(colname_z), lb=[0] * len(colname_z), ub=[1] * len(colname_z), names=colname_z, types=["N" * len(colname_z)]) # Create slack variables for second objective function # with weights of 0.5 each for the objective function model.variables.add(obj=[0.5, 0.5], lb=[0, 0], names=['c', 'd']) ### Add Hess constraints # sum_j x_jj = k (there are exactly k centers) indices = [x_varindex(j, j) for j in range(n)] coeffs = [1] * n model.linear_constraints.add(lin_expr=[cplex.SparsePair(indices, coeffs)], senses=["E"], rhs=[k]) for i in range(n): for j in range(n): if j == i: continue # x_ij <= x_jj for all i,j in V indices = [x_varindex(i, j), x_varindex(j, j)] coeffs = [1, -1] model.linear_constraints.add(lin_expr=[cplex.SparsePair(indices, coeffs)], senses="L", rhs=[0]) # sum_j x_ij = 1 for all i in V (every unit assigned) indices = [x_varindex(i, j) for j in range(n)] coeffs = [1] * n model.linear_constraints.add(lin_expr=[cplex.SparsePair(indices, coeffs)], senses=["E"], rhs=[1]) # Determine ideal (average) district population and upper/lower bounds avg_pop = plan_a.graph.data['population'].sum() / k pop_lb = (1 - tau) * avg_pop pop_ub = (1 + tau) * avg_pop for j in range(n): indices = [x_varindex(i, j) for i in range(n)] lb_coeffs = [1] * n lb_coeffs[j] -= pop_lb # Subtract lower-bound from x_jj coeff model.linear_constraints.add(lin_expr=[cplex.SparsePair(indices, lb_coeffs)], senses=["G"], rhs=[0]) ub_coeffs = [1] * n ub_coeffs[j] -= pop_ub # Subtract upper-bound from x_jj coeff model.linear_constraints.add(lin_expr=[cplex.SparsePair(indices, ub_coeffs)], senses=["L"], rhs=[0]) ### Add Shirabe flow-based contiguity constraints (using Validi et al. notation) # Compute in-/out-adjacency (really, edge) lists for all vertices in_edges = [set() for v in range(n)] out_edges = [set() for v in range(n)] for e in dir_edges: in_edges[e[1] - 1].add(e) out_edges[e[0] - 1].add(e) # (2b) f^j (\delta^-(i)) - f^j (\delta^+(i)) = x_ij (move x_ij to LHS) for j in range(n): for i in range(n): if i == j: continue names = [x_varindex(i, j)] coeffs = [-1] for e in in_edges[i]: names.append('f{0}_{1}'.format(j + 1, e)) coeffs.append(1) for e in out_edges[i]: names.append('f{0}_{1}'.format(j + 1, e)) coeffs.append(-1) model.linear_constraints.add(lin_expr=[cplex.SparsePair(names, coeffs)], senses=["E"], rhs=[0]) # (2c) f^j (\delta^-(i)) <= (n - 1) * x_ij (move (n-1) * x_ij to LHS) for j in range(n): for i in range(n): if i == j: continue names = [x_varindex(i, j)] coeffs = [1 - n] # Subtract (n - 1) x_ij for e in in_edges[i]: names.append('f{0}_{1}'.format(j + 1, e)) coeffs.append(1) model.linear_constraints.add(lin_expr=[cplex.SparsePair(names, coeffs)], senses=["L"], rhs=[0]) # (2d) f^j (\delta^-(j)) = 0 for j in range(n): names = ['f{0}_{1}'.format(j + 1, e) for e in in_edges[j]] coeffs = [1] * len(names) model.linear_constraints.add(lin_expr=[cplex.SparsePair(names, coeffs)], senses=["E"], rhs=[0]) ### Add cut-edge constraints for index, e in enumerate(edges): y_name = colname_y[index] names = [y_name] i, j = e i -= 1 j -= 1 for v in range(n): z_name = colname_z[z_varindex(v, index)] names.append(z_name) xi_name = colname_x[x_varindex(i, v)] xj_name = colname_x[x_varindex(j, v)] # z^v_{ij} >= x_{iv} + x_{jv} - 1 model.linear_constraints.add(lin_expr=[cplex.SparsePair([z_name, xi_name, xj_name], [1, -1, -1])], senses=["G"], rhs=[-1]) # z^v_{ij} <= x_{iv} model.linear_constraints.add(lin_expr=[cplex.SparsePair([z_name, xi_name], [1, -1])], senses=["L"], rhs=[0]) # z^v_{ij} <= x_{jv} model.linear_constraints.add(lin_expr=[cplex.SparsePair([z_name, xj_name], [1, -1])], senses=["L"], rhs=[0]) coeffs = [1] * len(names) model.linear_constraints.add(lin_expr=[cplex.SparsePair(names, coeffs)], senses=["E"], rhs=[1]) ### Add alpha and beta variables and constraints colname_alpha = ["alpha{0}".format(e) for e in edges] # These variables are included in the objective function # to capture D(A, Y) + D(Y, B). Since D(A, B) is constant w.r.t. Y, # we don't need to explicitly include it in the objective function. model.variables.add(obj=[0.5 / len(edges)] * len(colname_alpha), lb=[0] * len(colname_alpha), ub=[1] * len(colname_alpha), names=colname_alpha, types=["N" * len(colname_alpha)]) colname_beta = ["beta{0}".format(e) for e in edges] model.variables.add(obj=[0.5 / len(edges)] * len(colname_beta), lb=[0] * len(colname_beta), ub=[1] * len(colname_beta), names=colname_beta, types=["N" * len(colname_beta)]) for index, e in enumerate(edges): alpha_name = colname_alpha[index] beta_name = colname_beta[index] y_name = colname_y[index] for var_name, indicator_vector in zip([alpha_name, beta_name], [a, b]): if indicator_vector[index] == 1: # alpha/beta_e = 1 XOR y_e = 1 - y_e model.linear_constraints.add(lin_expr=[cplex.SparsePair([var_name, y_name], [1, 1])], senses=["E"], rhs=[1]) else: # alpha/beta_e = 0 XOR y_e = y_e model.linear_constraints.add(lin_expr=[cplex.SparsePair([var_name, y_name], [1, -1])], senses=["E"], rhs=[0]) ### Add c and d slack variables constraint names = ['c', 'd'] coeffs = [1, -1] recip_num_edges = 1. / len(edges) neg_recip_num_edges = -1. / len(edges) for index, e in enumerate(edges): names.append(colname_alpha[index]) coeffs.append(recip_num_edges) names.append(colname_beta[index]) coeffs.append(neg_recip_num_edges) # D(A, Y) + c = D(Y, B) + d model.linear_constraints.add(lin_expr=[cplex.SparsePair(names, coeffs)], senses=["E"], rhs=[0]) return model, n def find_midpoint(plan_a, plan_b, num_hybrids=0, warmstarts_file=None): """ Finds the midpoint of two district plans by building and solving a MIP. Generates num_hybrids randomized hybrid Partition objects to warm-start the MIP solver. If warmstarts_file is given, it's a path to a .sol or .mst XML file containing feasible solution(s) used to warm-start the MIP solver. If warmstarts_file is None (default), then 'warmstarts.mst' is prepared as the default warmstarts file. Returns the midpoint plan as a Partition object. """ model, n = build_midpoint_milp(plan_a, plan_b) # Clear warmstarts file if warmstarts_file is None: warmstarts_file = 'warmstarts.mst' clear_warmstarts() else: clear_warmstarts(warmstarts_file) hybrids = [] index = 0 while (index < num_hybrids): hybrids.append(hybrid.generate_hybrid(plan_a, plan_b)) index += 1 print('Generated hybrid #{0}.'.format(index)) add_warmstarts(model, plan_a, plan_b, hybrids=hybrids, warmstarts_file=warmstarts_file) try: model.solve() model.write('midpoint_py.lp') model.solution.write('midpoint_py_solution.sol') # Create a Partition object from the model's solution graph = plan_a.graph.copy() n = plan_a.graph.number_of_nodes() nodes = [node for node in graph.nodes()] assignment = {} def x_varindex(i, j): return i * n + j district_index = 0 for i in range(n): if model.solution.get_values('x{0}'.format(x_varindex(i, i) + 1)) >= 1: district_index += 1 for j in range(n): if model.solution.get_values('x{0}'.format(x_varindex(j, i) + 1)) >= 1: assignment[nodes[j]] = district_index try: midpoint = gerrychain.Partition(graph, assignment, updaters={ 'population': gerrychain.updaters.Tally('population') }) # The updater {'cut_edges': cut_edges} is included by default) midpoint.graph.add_data(plan_a.graph.data) except Exception as e: print(e) traceback.print_exc() return helpers.add_assignment_as_district_col(midpoint) except CplexError as exception: print(sys.exc_info()) print(exception) sys.exit(-1) def add_warmstarts(model, plan_a, plan_b, hybrids=[], warmstarts_file='warmstarts.mst', warmstart_name_prefix=None): """ Wrapper for add_warmstart to support multiple warmstarts. """ if not hybrids: # If hybrids is empty, still attempt to use warmstarts_file model.MIP_starts.read(warmstarts_file) return # Load existing XML of warmstarts tree = helpers.load_warmstarts_xml(file=warmstarts_file) # Extract names of existing warm-starts from "header" tag, # the first child of each CPLEXSolution warmstart_names = [child[0].attrib.get('solutionName', None) for child in tree.getroot()] # Add a warmstart to the XML for each provided hybrid plan for index, hybrid in enumerate(hybrids): cplex_sol = ET.SubElement(tree.getroot(), 'CPLEXSolution') cplex_sol.attrib['version'] = '1.2' header = ET.SubElement(cplex_sol, 'header') # Ensure new warmstart name is unused # WARNING: can have an infinite loop here if more than 10000 warm starts in use. # Could fix by replacing with incremental approach (warmstart_0, warmstart_1, etc.), # but we likely won't use more than 100 warmstarts at a time. new_warmstart_name = 'warmstart' if warmstart_name_prefix is None else warmstart_name_prefix while new_warmstart_name in warmstart_names: new_warmstart_name = '{0}_{1:04.0f}'.format(new_warmstart_name, 10000 * random.random()) warmstart_names.append(new_warmstart_name) header.attrib = {'problemName': 'midpoint_py', 'solutionName': new_warmstart_name} variables = ET.SubElement(cplex_sol, 'variables') add_warmstart_xml(variables_xml=variables, model=model, plan_a=plan_a, plan_b=plan_b, hybrid=hybrid) # Save updated warm-starts XML file helpers.save_warmstarts_xml(tree=tree, file=warmstarts_file) # 8. Set the start values for the MIP model model.MIP_starts.read(warmstarts_file) model.parameters.output.intsolfileprefix.set('midpoint_int_solns') # ^ uncomment to save feasible integer solutions found during branch & cut to files # with the naming scheme [prefix]-[five-digit index, starting at 1].sol return def clear_warmstarts(warmstarts_file='warmstarts.mst'): """ Removes any warmstarts in the given .mst file. Leaves the CPLEXSolutions tag so new warmstarts can still be added. """ tree = helpers.load_warmstarts_xml(file=warmstarts_file) root = tree.getroot() # Workaround to avoid issues with iterating while removing children = [child for child in root] for child in children: root.remove(child) helpers.save_warmstarts_xml(tree=tree, file=warmstarts_file) return def add_warmstart_xml(variables_xml, model, plan_a, plan_b, hybrid): """ Adds variable assignments corresponding to the given hybrid plan as children of the variables_xml XML element to be later used to warm-start the MIP. variables_xml - the XML 'variables' element, parent of all individual assignments model - a Cplex object plan_a - the first district plan plan_b - the second district plan hybrid - a Partition object """ n = hybrid.graph.number_of_nodes() m = hybrid.graph.number_of_edges() nodes = list(hybrid.graph.nodes()) edges = list(hybrid.graph.edges()) a = extract_plan_constants(plan_a) b = extract_plan_constants(plan_b) var_names = [model.variables.get_names(i) for i in range(model.variables.get_num())] # Initialize variable assignments x = np.zeros((n, n)) f = np.zeros((n, 2 * m)) y = np.ones(m) z = np.zeros((m, n)) c = 0 d = 0 alpha = np.zeros(m) beta = np.zeros(m) # 1. Determine the x variable values for part in hybrid.parts: # For simplicity, make the "minimum" unit in each part the center center = min(hybrid.parts[part]) center_index = nodes.index(center) for unit in hybrid.parts[part]: unit_index = nodes.index(unit) x[unit_index, center_index] = 1 # 2. Determine the z variable values for edge_index, e in enumerate(edges): i, j = e i_index = nodes.index(i) j_index = nodes.index(j) for node_index, v in enumerate(nodes): # z^v_{ij} should be x_iv AND x_jv if (x[i_index, node_index] == 1 and x[j_index, node_index] == 1): z[edge_index, node_index] = 1 # 3. Determine the y variable values for edge_index, e in enumerate(edges): i, j = e i_index = nodes.index(i) j_index = nodes.index(j) for node_index, v in enumerate(nodes): # If v is the center of a district # to which both i and j are assigned, then # e is not a cut edge. if z[edge_index, node_index] == 1: y[edge_index] = 0. # 4. Determine the f (flow) variable values f = helpers.compute_feasible_flows(hybrid) # 5. Determine the c/d variable values dist_a_y = helpers.pereira_index(plan_a, hybrid)[0] dist_y_b = helpers.pereira_index(hybrid, plan_b)[0] # Recall: D(A, Y) + c = D(Y, B) + d if dist_a_y < dist_y_b: c = dist_y_b - dist_a_y else: d = dist_a_y - dist_y_b # 6. Determine the alpha/beta variable values for edge_index, e in enumerate(edges): if y[edge_index] + a[edge_index] == 1: # XOR alpha[edge_index] = 1. if y[edge_index] + b[edge_index] == 1: # XOR beta[edge_index] = 1. def add_variable_to_xml(var_name, value): """ Creates an xml SubElement of the given parent for the variable with the given name and value, fetching the index from var_names and casting the value to an integer if it is integral. """ if round(value) == value: value = int(value) variable = ET.SubElement(variables_xml, 'variable') variable.attrib = { 'name': '{0}'.format(var_name), 'index': '{0}'.format(var_names.index(var_name)), 'value': '{0}'.format(value)} return # Write variable assignments ## x: for i in range(x.shape[0]): for j in range(x.shape[1]): var_name = 'x{0}'.format(i * n + j + 1) value = x[i, j] add_variable_to_xml(var_name, value) ## f: for node_index in range(n): flow_node_index = node_index + 1 # In flow variable names, nodes are indexed 1 to n for edge_index, edge in enumerate(edges): # Edge in given direction var_name = 'f{0}_{1}'.format(flow_node_index, edge) value = f[node_index, 2 * edge_index] add_variable_to_xml(var_name, value) # Edge in reverse direction var_name = var_name = 'f{0}_{1}'.format(flow_node_index, (edge[1], edge[0])) value = f[node_index, 2 * edge_index + 1] add_variable_to_xml(var_name, value) ## y: for edge_index, edge in enumerate(edges): var_name = 'y{0}'.format(edge) value = y[edge_index] add_variable_to_xml(var_name, value) ## z: for node_index in range(n): for edge_index, edge in enumerate(edges): var_name = 'z{0}'.format(node_index * m + edge_index) value = z[edge_index, node_index] add_variable_to_xml(var_name, value) ## c/d: add_variable_to_xml('c', c) add_variable_to_xml('d', d) ## alpha/beta: for prefix in ['alpha', 'beta']: for edge_index, edge in enumerate(edges): var_name = '{0}{1}'.format(prefix, edge) value = alpha[edge_index] if prefix == 'alpha' else beta[edge_index] add_variable_to_xml(var_name, value) return def build_ruler_sequence(start, end, depth=1, num_hybrids=1): """ Recursively build a "ruler sequence" of district plans, that is, find the midpoint of the start and end plans (depth 1), then find the "quarterpoints" as midpoints of the midpoint and each of start/end (depth 2), and so on. Uses num_hybrids auto-generated hybrids as a warm-start for use in the midpoint MIP solver. Returns the sequence (list) of plans, beginning with start and ending with end. """ midpoint_plan = find_midpoint(plan_a=start, plan_b=end, num_hybrids=num_hybrids) # Base case: depth is 1 if depth == 1: return [start, midpoint_plan, end] first_half = build_ruler_sequence(start, midpoint_plan, depth=depth - 1, num_hybrids=num_hybrids) second_half = build_ruler_sequence(midpoint_plan, end, depth=depth - 1, num_hybrids=num_hybrids) return first_half + second_half[1:] if __name__ == '__main__': # # Example 1: Run simple test with vertical/horizontal stripes on r x r grid # r = 8 # # Flag for toggling custom hybrid # USE_SPECIAL_HYBRID = False # # Vertical stripes: # graph = helpers.build_grid_graph(r, r) # assignment = {} # for i in range(1, graph.number_of_nodes() + 1): # assignment[i] = r if i % r == 0 else i % r # vert_stripes = gerrychain.Partition(graph, assignment, updaters={ # 'population': gerrychain.updaters.Tally('population') # }) # The updater {'cut_edges': cut_edges} is included by default # helpers.add_assignment_as_district_col(vert_stripes) # # Horizontal stripes: # graph = helpers.build_grid_graph(r, r) # assignment = {} # for i in range(1, graph.number_of_nodes() + 1): # assignment[i] = (i - 1) // r + 1 # horiz_stripes = gerrychain.Partition(graph, assignment, updaters={ # 'population': gerrychain.updaters.Tally('population') # }) # The updater {'cut_edges': cut_edges} is included by default # helpers.add_assignment_as_district_col(horiz_stripes) # ruler_sequence = build_ruler_sequence(vert_stripes, horiz_stripes, depth=2, num_hybrids=100) # helpers.draw_grid_plan(ruler_sequence[0]) # should be vert_stripes # for i in range(1, len(ruler_sequence)): # distance = helpers.pereira_index(ruler_sequence[i - 1], ruler_sequence[i])[0] # print('\ndistance: {0:.3f}\n'.format(distance)) # helpers.draw_grid_plan(ruler_sequence[i]) # Example 2: Only use hybrids; don't actually try to find optimal midpoints r = 8 # Flag for toggling custom hybrid USE_SPECIAL_HYBRID = False # Vertical stripes: graph = helpers.build_grid_graph(r, r) assignment = {} for i in range(1, graph.number_of_nodes() + 1): assignment[i] = r if i % r == 0 else i % r vert_stripes = gerrychain.Partition(graph, assignment, updaters={ 'population': gerrychain.updaters.Tally('population') }) # The updater {'cut_edges': cut_edges} is included by default helpers.add_assignment_as_district_col(vert_stripes) # Horizontal stripes: graph = helpers.build_grid_graph(r, r) assignment = {} for i in range(1, graph.number_of_nodes() + 1): assignment[i] = (i - 1) // r + 1 horiz_stripes = gerrychain.Partition(graph, assignment, updaters={ 'population': gerrychain.updaters.Tally('population') }) # The updater {'cut_edges': cut_edges} is included by default helpers.add_assignment_as_district_col(horiz_stripes) mid = hybrid.generate_hybrid(vert_stripes, horiz_stripes) d1 = helpers.pereira_index(vert_stripes, mid)[0] d2 = helpers.pereira_index(mid, horiz_stripes)[0] print('d1 =', d1, ', d2 =', d2) q1 = hybrid.generate_hybrid(vert_stripes, mid) q3 = hybrid.generate_hybrid(mid, horiz_stripes) d11 = helpers.pereira_index(vert_stripes, q1)[0] d12 = helpers.pereira_index(q1, mid)[0] d21 = helpers.pereira_index(mid, q3)[0] d22 = helpers.pereira_index(q3, horiz_stripes)[0] print('d11 =', d11, ', d12 =', d12, ', d21 =', d21, ', d22 =', d22)
package com.javase.leetcode.datastructure.stack; import java.util.Stack; /** * Created by DD240 on 2016/10/25. */ public class MinStack { /** initialize your data structure here. */ Stack stack = new Stack<Integer>(); Stack minStack = new Stack<Integer>(); public MinStack() { } public void push(int x) { if(stack.isEmpty()) { stack.push(x); minStack.push(x); } else { stack.push(x); int min = Math.min(x, (int)minStack.peek()); minStack.push(min); } } public void pop() { stack.pop(); minStack.pop(); } public int top() { return (int)stack.peek(); } public int getMin() { return (int)minStack.peek(); } } /** * Your MinStack object will be instantiated and called as such: * MinStack obj = new MinStack(); * obj.push(x); * obj.pop(); * int param_3 = obj.top(); * int param_4 = obj.getMin(); */
. This is an ecological, analytical and retrospective study comprising the 645 municipalities in the State of So Paulo, the scope of which was to determine the relationship between socioeconomic, demographic variables and the model of care in relation to infant mortality rates in the period from 1998 to 2008. The ratio of average annual change for each indicator per stratum coverage was calculated. Infant mortality was analyzed according to the model for repeated measures over time, adjusted for the following correction variables: the city's population, proportion of Family Health Programs (PSFs) deployed, proportion of Growth Acceleration Programs (PACs) deployed, per capita GDP and SPSRI (So Paulo social responsibility index). The analysis was performed by generalized linear models, considering the gamma distribution. Multiple comparisons were performed with the likelihood ratio with chi-square approximate distribution, considering a significance level of 5%. There was a decrease in infant mortality over the years (p < 0.05), with no significant difference from 2004 to 2008 (p > 0.05). The proportion of PSFs deployed (p < 0.0001) and per capita GDP (p < 0.0001) were significant in the model. The decline of infant mortality in this period was influenced by the growth of per capita GDP and PSFs.