text
stringlengths
2
1.04M
meta
dict
<?php namespace Thessia\Tasks; use League\Container\Container; use MongoDB\BSON\UTCDateTime; use MongoDB\Collection; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class populateBattles extends Command { protected function configure() { $this ->setName("populateBattles") ->setDescription("Populates battles"); } protected function execute(InputInterface $input, OutputInterface $output) { // Get the container $container = getContainer(); /** @var \MongoClient $mongo */ $mongo = $container->get("mongo"); $killmails = $mongo->selectCollection("thessia", "killmails"); /** @var Collection $storage */ $storage = $mongo->selectCollection("thessia", "storage"); $battleCollection = $mongo->selectCollection("thessia", "battles"); /* * look over the killmail table in 2 hour chunks, each time advancing one hour, till there is a hit. * Then go over a 4 hour chunk of time, in 10 minute intervals to check for hits of 3 kills or more. * example: startTime = 2009-01-01 22:00:00, endTime = 2009-01-01 00:00:00 * A hit has been made in that two hour chunk, of 500 people. * Expand it by a 30 minutes in each direction (3 hours total) so start is 21:30 and end is 00:30 the next day. * Then look for killmails in a 10 minute interval * First hit of 3 kills or more, is registered as the start. * Once 6 chunks have registered false (meaning less than 3 kills), call the battle finished, and move forward an hour * It can go beyond 00:30 if it keeps getting hits of 3 kills or more. */ $startTime = strtotime(date("2007-12-05 20:00:00")); $endTime = time(); $mongoTime = (int) $storage->findOne(array("key" => "battleImporterStartTime"))["value"]; $searchTime = $mongoTime > 0 ? $mongoTime : $startTime; do { //$output->writeln("Checking for killmails between " . date("Y-m-d H:i:s", $searchTime - 3600) . " and " . date("Y-m-d H:i:s", $searchTime + 3600)); $timeAfter = new UTCDateTime(($searchTime - 3600) * 1000); $timeBefore = new UTCDateTime(($searchTime + 3600) * 1000); // Main aggregation pipeline $aggregation = array( array('$match' => array("killTime" => array('$gte' => $timeAfter, '$lte' => $timeBefore))), array('$group' => array('_id' => '$solarSystemID', 'count' => array('$sum' => 1))), array('$project' => array("_id" => 0, "count" => '$count', "solarSystemID" => '$_id')), array('$match' => array('count' => array('$gte' => 50))), array('$sort' => array('count' => -1)) ); // Run the pipeline $result = $killmails->aggregate($aggregation)->toArray(); // If there are results, we'll start to drill down into it if(count($result) >= 1) { //$output->writeln("Found " . count($result) . " battle(s)"); foreach($result as $battle) { //$output->writeln(count($result) . " battle(s) was found with " . $battle["count"] . " participants. Start to drill down."); $run = true; $fails = 0; $minTime = $searchTime - 3600; $solarSystemID = $battle["solarSystemID"]; $battleStartTime = 0; // Check if there has already been found a battle in this system, taking place within the last hour (and max 4 hours forward) $searchArray = array("solarSystemInfo.solarSystemID" => $solarSystemID, "startTime" => array('$gte' => new UTCDateTime(($minTime - 14400) * 1000))); //, "endTime" => array('$lte' => new UTCDateTime(($minTime + 14400) * 1000))); $battleCount = $battleCollection->find($searchArray)->toArray(); if(!empty($battleCount)) { continue; } do { $timeAfter = new UTCDateTime($minTime * 1000); $timeBefore = new UTCDateTime(($minTime + 600) * 1000); // Main aggregation pipeline $aggregation = array( array('$match' => array("solarSystemID" => $solarSystemID, "killTime" => array('$gte' => $timeAfter, '$lte' => $timeBefore))), array('$group' => array('_id' => '$solarSystemID', 'count' => array('$sum' => 1))), array('$project' => array("_id" => 0, "count" => '$count', "solarSystemID" => '$_id')), array('$match' => array('count' => array('$gte' => 3))), array('$sort' => array('count' => -1)) ); // Run the pipeline $result = $killmails->aggregate($aggregation)->toArray(); // Set the startTime of the battle if (count($result) >= 1 && $battleStartTime == 0) { $fails = 0; $battleStartTime = $minTime; } // It's all over.. (Time to log everything we've learned if ($fails >= 20 && $battleStartTime != 0) { $output->writeln("A battle happened in {$solarSystemID}, and started at " . date("Y-m-d H:i:s", $battleStartTime) . " and ended at " . date("Y-m-d H:i:s", $minTime - 12000)); // Process the battle report $this->processBattleReport($container, $battleStartTime, $minTime - 12000, $solarSystemID); // This one is done, lets call it quits and find more! $run = false; } elseif ($fails >= 20) { $run = false; } // Increment minTime by 10 minutes (In the end, it will increment minTime by 3600, meaning we have to subtract 3600 from minTime to get endTime $minTime = $minTime + 600; // If the array is empty, it's a fail, and we'll try again if (count($result) == 0) { $fails++; continue; } } while ($run == true); } } // Increment searchTime by an hour $searchTime = $searchTime + 3600; // Save how far we've come in the db $storage->replaceOne(array("key" => "battleImporterStartTime"), array("key" => "battleImporterStartTime", "value" => $searchTime), array("upsert" => true)); } while($searchTime < $endTime); } private function processBattleReport(Container $container, $startTime, $endTime, $solarSystemID) { $mongo = $container->get("mongo"); $collection = $mongo->selectCollection("thessia", "battles"); $killmails = $mongo->selectCollection("thessia", "killmails"); $solarSystemCollection = $mongo->selectCollection("ccp", "solarSystems"); /* * Figure out sides in this battle, and store side A and side B * * Hijack https://github.com/evekb/evedev-kb/blob/4.0/common/kill_related.php#L309-L340 */ // Find the kills in the system that happened for this battle $findArray = array( array('$match' => array("solarSystemID" => $solarSystemID, "killTime" => array('$gte' => new UTCDateTime($startTime * 1000), '$lte' => new UTCDateTime($endTime * 1000)))), array('$unwind' => '$attackers') ); $killData = $killmails->aggregate($findArray)->toArray(); foreach($killData as $key => $val) { unset($killData[$key]["osmium"]); } $redTeam = array(); $redTeamCharacters = array(); $redTeamShips = array(); $redTeamCorporations = array(); $redTeamKills = array(); $blueTeam = array(); $blueTeamCharacters = array(); $blueTeamShips = array(); $blueTeamCorporations = array(); $blueTeamKills = array(); $success = $this->findTeams($redTeam, $blueTeam, $killData); if($success == false) return; foreach($redTeam as $member) { foreach($killData as $mail) { if($mail["attackers"]["allianceName"] == $member) { if($mail["attackers"]["corporationName"] != "" && !in_array($mail["attackers"]["corporationName"], $redTeamCorporations)) $redTeamCorporations[] = $mail["attackers"]["corporationName"]; if(!in_array($mail["attackers"]["characterName"], $redTeamCharacters)) { if (!isset($redTeamShips[$mail["attackers"]["shipTypeName"]])) { $redTeamShips[$mail["attackers"]["shipTypeName"]] = array( "shipTypeName" => $mail["attackers"]["shipTypeName"], "count" => 1 ); } else { $redTeamShips[$mail["attackers"]["shipTypeName"]]["count"]++; } } if(!in_array($mail["attackers"]["characterName"], $redTeamCharacters)) $redTeamCharacters[] = $mail["attackers"]["characterName"]; if(!in_array($mail["killID"], $redTeamKills)) $redTeamKills[] = $mail["killID"]; } } } foreach($blueTeam as $member) { foreach($killData as $mail) { if($mail["attackers"]["allianceName"] == $member) { if($mail["attackers"]["corporationName"] != "" && !in_array($mail["attackers"]["corporationName"], $blueTeamCorporations)) $blueTeamCorporations[] = $mail["attackers"]["corporationName"]; if(!in_array($mail["attackers"]["characterName"], $blueTeamCharacters)) { if (!isset($blueTeamShips[$mail["attackers"]["shipTypeName"]])) { $blueTeamShips[$mail["attackers"]["shipTypeName"]] = array( "shipTypeName" => $mail["attackers"]["shipTypeName"], "count" => 1 ); } else { $blueTeamShips[$mail["attackers"]["shipTypeName"]]["count"]++; } } if(!in_array($mail["attackers"]["characterName"], $blueTeamCharacters)) $blueTeamCharacters[] = $mail["attackers"]["characterName"]; if(!in_array($mail["killID"], $blueTeamKills)) $blueTeamKills[] = $mail["killID"]; } } } // Remove the overlap if(count($blueTeamKills) > count($redTeamKills)) { foreach($blueTeamKills as $key => $id) { if(in_array($id, $redTeamKills)) unset($blueTeamKills[$key]); } } else { foreach($redTeamKills as $key => $id) { if(in_array($id, $blueTeamKills)) unset($redTeamKills[$key]); } } if(!empty($redTeam) && !empty($blueTeam) && !empty($redTeamCorporations) && !empty($blueTeamCorporations)) { // Quite possibly hilariously incorrect... $dataArray = array( "startTime" => new UTCDateTime($startTime * 1000), "endTime" => new UTCDateTime($endTime * 1000), "solarSystemInfo" => $solarSystemCollection->findOne(array("solarSystemID" => $solarSystemID)), "teamRed" => array( "characters" => array_values($redTeamCharacters), "corporations" => array_values($redTeamCorporations), "alliances" => array_values($redTeam), "ships" => array_values($redTeamShips), "kills" => array_values($redTeamKills) ), "teamBlue" => array( "characters" => array_values($blueTeamCharacters), "corporations" => array_values($blueTeamCorporations), "alliances" => array_values($blueTeam), "ships" => array_values($blueTeamShips), "kills" => array_values($blueTeamKills) ) ); $battleID = md5(json_encode($dataArray)); $dataArray["battleID"] = $battleID; // Insert the data to the battles table try { $collection->replaceOne(array("battleID" => $battleID), $dataArray, array("upsert" => true)); } catch(\Exception $e) { var_dump("Welp, an error happened.. " . $e->getMessage()); } } } /* * */ private function findTeams(&$redTeam, &$blueTeam, $killData) { $allianceTempArray = array(); $corporationTempArray = array(); // Should i map on alliances? $this->allianceSides($allianceTempArray, $blueTeam, $redTeam, $killData); if(empty($blueTeam) || empty($redTeam)) $this->corporationSides($corporationTempArray, $blueTeam, $redTeam, $killData); if(empty($blueTeam) || empty($redTeam)) { return false; } // teamSizes $redTeamSize = count($redTeam); $blueTeamSize = count($blueTeam); if($redTeamSize > $blueTeamSize) { foreach($redTeam as $key => $player) { if(in_array($player, $blueTeam)) unset($redTeam[$key]); if($player == "") unset($redTeam[$key]); } } else { foreach($blueTeam as $key => $player) { if(in_array($player, $redTeam)) unset($blueTeam[$key]); if($player == "") unset($blueTeam[$key]); } } return true; } private function allianceSides(&$allianceTempArray, &$blueTeam, &$redTeam, $killData) { foreach($killData as $data) { $attacker = $data["attackers"]; $victim = $data["victim"]; if (isset($attacker["allianceName"]) && isset($victim["allianceName"]) && $victim["allianceName"] != "") { if (@!in_array($attacker["allianceName"], $allianceTempArray[$victim["allianceName"]])) { $allianceTempArray[$victim["allianceName"]][] = $attacker["allianceName"]; } else { continue; } } } // Clean up any strings that are empty foreach($allianceTempArray as $key => $innerArray) { foreach($innerArray as $ikey => $welp) { if($welp == "") unset($allianceTempArray[$key][$ikey]); } } // Find the red team $size = 0; $redTeamVictim = ""; foreach($allianceTempArray as $victim => $attacker) { $attackers = count($attacker); if($attackers > $size) { $size = $attackers; $redTeam = $attacker; $redTeamVictim = $victim; } } // Unset the redTeam from the tempArray unset($allianceTempArray[$redTeamVictim]); // Find the blue team foreach($allianceTempArray as $blue) { foreach($blue as $member) { if(!in_array($member, $blueTeam)) $blueTeam[] = $member; } } } private function corporationSides(&$corporationTempArray, &$blueTeam, &$redTeam, $killData) { foreach($killData as $data) { $attacker = $data["attackers"]; $victim = $data["victim"]; if (isset($attacker["corporationName"]) && isset($victim["corporationName"]) && $victim["corporationName"] != "") { if (@!in_array($attacker["corporationName"], $corporationTempArray[$victim["corporationName"]])) { $corporationTempArray[$victim["corporationName"]][] = $attacker["corporationName"]; } else { continue; } } } // Clean up any strings that are empty foreach($corporationTempArray as $key => $innerArray) { foreach($innerArray as $ikey => $welp) { if($welp == "") unset($corporationTempArray[$key][$ikey]); } } // Find the red team $size = 0; $redTeamVictim = ""; foreach($corporationTempArray as $victim => $attacker) { $attackers = count($attacker); if($attackers > $size) { $size = $attackers; $redTeam = $attacker; $redTeamVictim = $victim; } } // Unset the redTeam from the tempArray unset($corporationTempArray[$redTeamVictim]); // Find the blue team foreach($corporationTempArray as $blue) { foreach($blue as $member) { if(!in_array($member, $blueTeam)) $blueTeam[] = $member; } } } }
{ "content_hash": "c71799ef9ab645e1a6022c67fa82a27d", "timestamp": "", "source": "github", "line_count": 402, "max_line_length": 247, "avg_line_length": 45.40298507462686, "alnum_prop": 0.48767258382643, "repo_name": "new-eden/Thessia", "id": "c5dd342742a51828bb5d21762a5d4a4f3879e40f", "size": "19425", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tasks/populateBattles.php", "mode": "33261", "license": "mit", "language": [ { "name": "HTML", "bytes": "1202" }, { "name": "PHP", "bytes": "141653" } ], "symlink_target": "" }
package info.ryanford.movieinspector.ui; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.NavigationView; import android.support.design.widget.Snackbar; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import butterknife.ButterKnife; import info.ryanford.movieinspector.R; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { // Handle the camera action } else if (id == R.id.nav_gallery) { } else if (id == R.id.nav_slideshow) { } else if (id == R.id.nav_manage) { } else if (id == R.id.nav_share) { } else if (id == R.id.nav_send) { } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
{ "content_hash": "b5298e9841e43420fee2393660199449", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 112, "avg_line_length": 34.36190476190476, "alnum_prop": 0.6707317073170732, "repo_name": "ryancford/movie-inspector", "id": "d96bd92a51e4bcec544b68714250095469d617cf", "size": "3608", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "mobile/src/main/java/info/ryanford/movieinspector/ui/MainActivity.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "75390" } ], "symlink_target": "" }
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>easyframe</artifactId> <groupId>org.easy</groupId> <version>1.0</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>frame-external-call</artifactId> <packaging>jar</packaging> <name>frame-external-call</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> </dependencies> </project>
{ "content_hash": "994620d5c4b9bf3c50aa550f74731d9a", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 108, "avg_line_length": 30.91304347826087, "alnum_prop": 0.659634317862166, "repo_name": "xiaojianyu315/jsponge", "id": "d0bc409e684fa07465bd5450be27fc4af560c471", "size": "711", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "frame-external-call/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "670243" }, { "name": "HTML", "bytes": "481491" }, { "name": "Java", "bytes": "105503" }, { "name": "JavaScript", "bytes": "684398" }, { "name": "Roff", "bytes": "100054" } ], "symlink_target": "" }
def auth(pass_file,auth_type): def deco(func): def wrapper(*args,**kwargs): if auth_type=='file': name=input('Please input your username: ') passwd=input('Please input your password: ') with open(pass_file) as f: for line in f: if name in line and passwd in line: res=func(*args,**kwargs) return res # elif auth_type=='ldap': # print('ldap auth success') # res=func(*args,**kwargs) # return res return wrapper return deco @auth('db.txt',auth_type='file') def foo(): print('This is foo') foo()
{ "content_hash": "326838d39bf64d561fa2b064ac978399", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 60, "avg_line_length": 29.6, "alnum_prop": 0.46621621621621623, "repo_name": "Ocean-Openstack/01-openstack-homework", "id": "e44d25be6e73e03264992cfb51c93fbd9d476898", "size": "765", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Day4/shaobo/file_auth/main.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "40225" } ], "symlink_target": "" }
/* Public domain */ #ifndef _AGAR_WIDGET_FSPINBUTTON_H_ #define _AGAR_WIDGET_FSPINBUTTON_H_ #include <agar/gui/widget.h> #include <agar/gui/textbox.h> #include <agar/gui/button.h> #include <agar/gui/ucombo.h> #include <agar/gui/units.h> #include <agar/gui/begin.h> #define AG_FSPINBUTTON_NOHFILL 0x01 #define AG_FSPINBUTTON_VFILL 0x02 typedef struct ag_fspinbutton { struct ag_widget wid; double value; /* Default value binding */ double min, max; /* Default range bindings */ double inc; /* Increment for buttons */ char format[32]; /* Printing format */ const AG_Unit *unit; /* Conversion unit in use */ int writeable; /* 0 = read-only */ char inTxt[64]; /* Input text buffer */ AG_Textbox *input; AG_UCombo *units; AG_Button *incbu; AG_Button *decbu; } AG_FSpinbutton; __BEGIN_DECLS extern AG_WidgetClass agFSpinbuttonClass; AG_FSpinbutton *AG_FSpinbuttonNew(void *, Uint, const char *, const char *); void AG_FSpinbuttonSizeHint(AG_FSpinbutton *, const char *); #define AG_FSpinbuttonPrescale AG_FSpinbuttonSizeHint void AG_FSpinbuttonSetValue(AG_FSpinbutton *, double); void AG_FSpinbuttonAddValue(AG_FSpinbutton *, double); void AG_FSpinbuttonSetMin(AG_FSpinbutton *, double); void AG_FSpinbuttonSetMax(AG_FSpinbutton *, double); void AG_FSpinbuttonSetRange(AG_FSpinbutton *, double, double); void AG_FSpinbuttonSetIncrement(AG_FSpinbutton *, double); void AG_FSpinbuttonSelectUnit(AG_FSpinbutton *, const char *); void AG_FSpinbuttonSetPrecision(AG_FSpinbutton *, const char *, int); void AG_FSpinbuttonSetWriteable(AG_FSpinbutton *, int); __END_DECLS #include <agar/gui/close.h> #endif /* _AGAR_WIDGET_FSPINBUTTON_H_ */
{ "content_hash": "ee13ef64a2ed78d86b5423ebd40340e5", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 76, "avg_line_length": 31.98076923076923, "alnum_prop": 0.7378232110643416, "repo_name": "varialus/agar", "id": "a56ddbe71ff5307e6853a74838342d784c806abf", "size": "1663", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "original/TrunkRevision9625/gui/fspinbutton.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Ada", "bytes": "475258" }, { "name": "C", "bytes": "3649600" }, { "name": "C++", "bytes": "60425" }, { "name": "CSS", "bytes": "1186" }, { "name": "JavaScript", "bytes": "21274" }, { "name": "Lua", "bytes": "24529" }, { "name": "Objective-C", "bytes": "344242" }, { "name": "Perl", "bytes": "176971" }, { "name": "Racket", "bytes": "654" }, { "name": "Scala", "bytes": "726" }, { "name": "Shell", "bytes": "315225" } ], "symlink_target": "" }
@interface BPQuery() @property (strong) NSMutableDictionary *request; @property (strong) NSString *path; @property int retryCount; @property bpquery_completion_block completionBlock; @end @implementation BPQuery @synthesize endpoint = _endpoint; - (instancetype)initWithEndpoint:(NSString *)name { self = [super init]; if (self) { _endpoint = name; } return self; } + (BPQuery *)queryForEndpoint:(NSString *)name { return [[BPQuery alloc] initWithEndpoint:name]; } - (void)setQuery:(NSDictionary *)where withBlock:(void (^)(NSError *error, NSArray *objects))completionBlock { [self setQuery:where withBlock:completionBlock andRetryCount:0]; } - (void)setQuery:(NSDictionary *)where withBlock:(bpquery_completion_block)completionBlock andRetryCount:(int)retry_count { _request = @{ @"where" : where.mutableCopy}.mutableCopy; _path = [NSString stringWithFormat:@"%@/query",self.endpoint]; _completionBlock = completionBlock; _retryCount = retry_count; } -(void)setQueryKey:(NSString *)key to:(NSObject *)value { if(_request == nil) { _request = @{@"where": @{}.mutableCopy}.mutableCopy; } else if(_request[@"where"] == nil) { _request[@"where"] = @{}.mutableCopy; } _request[@"where"][key] = value; } - (void)execute { [BPApi post:_path withData:_request andBlock:^(NSError *error, id responseObject) { if(error) { if(_retryCount > 2) { _completionBlock(error, @[]); } else { _retryCount++; [self execute]; } } else { NSArray *objects = responseObject[@"response"][_endpoint]; if([objects isEqual:[NSNull null]]) { objects = @[]; } _completionBlock(error, objects); } }]; } - (NSString *)cacheKey { NSLog(@"%@", self.request); NSData *json_data = [NSJSONSerialization dataWithJSONObject:self.request options:0 error:nil]; NSString *json = [[NSString alloc] initWithData:json_data encoding:NSUTF8StringEncoding]; return [NSString stringWithFormat:@"%@%@", json, self.path]; } @end
{ "content_hash": "cf4638fc0cb001bbc211e10987b1e2b3", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 108, "avg_line_length": 26.359550561797754, "alnum_prop": 0.5763000852514919, "repo_name": "BlueprintProject/Blueprint-Cocoa", "id": "a9694f1e0f2e58fb123decdd96508337ebb91655", "size": "2538", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Blueprint/Adapter/BPQuery.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "44601" }, { "name": "Objective-C", "bytes": "266344" }, { "name": "Ruby", "bytes": "6233" }, { "name": "Swift", "bytes": "193" } ], "symlink_target": "" }
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html lang="en-GB" class="no-js not-ie8"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Assessment schedule | Apply for the Civil Service Fast Stream</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="format-detection" content="telephone=no"> <!--[if gt IE 8]><!--> <link href="../_assets/css/main.css" media="all" rel="stylesheet" type="text/css"><!--<![endif]--> <!--[if lte IE 8]><link href="../_assets/css/main-ie8.css" media="all" rel="stylesheet" type="text/css"><![endif]--> <link rel="shortcut icon" href="../_assets/img/favicon.ico" type="image/x-icon"> <link href="../_assets/css/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <script> var html = document.documentElement; html.className += " js-enabled"; if (!('open' in document.createElement('details'))) { document.documentElement.className += ' no-details'; } </script> <script src="../_assets/js/vendor/modernizr-custom.js"></script> <script src="../_assets/js/vendor/jquery-1.11.1.min.js"></script> <script src="../_assets/js/vendor/jstorage.js"></script> </head> <body class="admin-container"> <div class="panel-ie"> <img src="../_assets/img/logo-ie.png" height="50" alt="Not optimised for IE 9 and lower" align="left"> <p>It looks like you're using a version of Internet Explorer that this prototype has not tested with - For the best experience, please switch to a modern browser.</p> <p><a href="" id="hideIEMessage">Hide this message</a></p> </div> <!-- <div id="global-cookie-message" class="cookie-banner"> <div class="content-container"> <span class="copy-16">GOV.UK uses cookies to make the site simpler. <a href="#">Find out more about cookies</a></span> </div> </div> --> <div class="skiplink-container header-skiplink"> <div> <a href="#main" class="skiplink">Skip to main content</a> </div> </div> <header role="banner" class="global-header"> <div class="global-header__wrapper"> <div class="grid-wrapper"> <div class="grid grid-3-4"> <h1 class="bold-small">Apply for a Civil Service apprenticeship | Administration</h1> </div> <div class="grid grid-1-4"> <div class="nav-menu "> <a class="nav-menu__trigger" href="" id="headerNavigation">Navigation</a> <ul class="nav-menu__items toggle-content"> <li><a href="find-candidate.html">Find a candidate</a></li> <li><a href="reporting.html">Reporting</a></li> <li><a href="campaign.html">Campaign management</a></li> <li><a href="manage-user.html">Manage users</a></li> <li><a href="passmark-index.html">Online test pass marks</a></li> <li><a href="assessment-schedule.html">Assessment centre schedule</a></li> <li><a href="assessment-passmarks.html">Assessment centre pass marks</a></li> </ul> </div> </div> </div> </div> </header> <div class="content-container"> <main role="main" id="main"> <div class="panel-info toggle-content" id="managingCandidatePanel"> <p>You are currently managing the slot for: <b id="candidateManaging">John Smith</b>.</p> <p><a href="" id="stopManagingCandidate">Stop managing</a></p> </div> <div class="grid-wrapper"> <div class="grid grid-2-3"> <div class="hgroup para-btm-margin"> <h1 class="heading-xlarge"> Schedule for: London 1 </h1> <a href="assessment-schedule.html">Return to assessment schedule</a> </div> </div> <div class="grid grid-1-3 ta-right"> <span class="booked-slot">Booked slot</span> <span class="unconfirmed-slot">Unconfirmed slot</span> </div> </div> <div class="grid-wrapper week-selector med-btm-margin"> <div class="grid grid-1-4 week-prev"> <a href="" disabled>&lt; Previous week</a> </div> <div class="grid grid-1-2 week-middle"> <label for="weekSelector" class="bold-small small-right-margin">Select week</label> <select name="" id="weekSelector"> <option value="">Week 1 (Monday 25/04)</option> <option value="">Week 2 (Monday 02/05)</option> <option value="">Week 3 (Monday 09/05)</option> <option value="">Week 4 (Monday 16/05)</option> <option value="">Week 5 (Monday 23/05)</option> <option value="">Week 6 (Monday 30/05)</option> <option value="">Week 7 (Monday 06/06)</option> <option value="">Week 8 (Monday 13/06)</option> <option value="">Week 9 (Monday 20/06)</option> <option value="">Week 10 (Monday 27/06)</option> </select> </div> <div class="grid grid-1-4 week-next"> <a href="">Following week &gt;</a> </div> </div> <table class="schedule-table"> <colgroup> <col class="t2" /> <col class="t19-5" /> <col class="t19-5" /> <col class="t19-5" /> <col class="t19-5" /> <col class="t19-5" /> <col/> </colgroup> <thead> <tr> <th></th> <th>Monday <span class="day-date">25/04</span></th> <th>Tuesday <span class="day-date">26/04</span></th> <th>Wednesday <span class="day-date">27/04</span></th> <th>Thursday <span class="day-date">28/04</span></th> <th>Friday <span class="day-date">29/04</span></th> </tr> </thead> <tbody class="half-day" data-half="1"> <tr> <td class="half-day-title" rowspan="6"><span class="rotatedtext">Morning</span></td> <td data-daycol="1"> <div class="booked-slot"> <div class="candidate-name">John Smith</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="unconfirmed-slot"> <div class="candidate-name">Jeffrey Knight</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Carey Smithson</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="unconfirmed-slot"> <div class="candidate-name">Otha Bhatia</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="booked-slot"> <div class="candidate-name">Tamika Chartier</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="booked-slot"> <div class="candidate-name">Barry Grant</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="unconfirmed-slot"> <div class="candidate-name">Sally Butcher</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Tamika Chartier</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="booked-slot"> <div class="candidate-name">Jacalyn Hill</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="booked-slot"> <div class="candidate-name">Sheri Strey</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="unconfirmed-slot"> <div class="candidate-name">Lashonda Gillooly</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="booked-slot"> <div class="candidate-name">Domonique Eutsler  </div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Aline Marconi</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="booked-slot"> <div class="candidate-name">Denae Yetman</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="booked-slot"> <div class="candidate-name">Brittani Musgrove</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="booked-slot"> <div class="candidate-name">Doretta Lupercio</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Jackson Duffer</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="5"> <div class="unconfirmed-slot"> <div class="candidate-name">Jacinta Richison</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="2"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="3"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="4"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="5"> <div class="unconfirmed-slot"> <div class="candidate-name">Jerald Brannon</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="2"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="3"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="4"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="5"> <div class="unconfirmed-slot"> <div class="candidate-name">Bryanna Kirst</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> </tbody> <tbody class="half-day" data-half="2"> <tr> <td class="half-day-title" rowspan="6"><span class="rotatedtext">Afternoon</span></td> <td data-daycol="1"> <div class="booked-slot"> <div class="candidate-name">Susie Woodman</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="unconfirmed-slot"> <div class="candidate-name">Pansy Ewers</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Jene Mixon</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="unconfirmed-slot"> <div class="candidate-name">Gregorio Alan</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="booked-slot"> <div class="candidate-name">Ryan Calahan</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="booked-slot"> <div class="candidate-name">Michael Franks</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="unconfirmed-slot"> <div class="candidate-name">Lilli Antilla</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Nobuko Sink</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="unconfirmed-slot"> <div class="candidate-name">Ulrike Richburg</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="booked-slot"> <div class="candidate-name">Thomasina Swopes</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="unconfirmed-slot"> <div class="candidate-name">Alyson Newhall</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="unconfirmed-slot"> <div class="candidate-name">Refugio Plemmons</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="booked-slot"> <div class="candidate-name">Corazon Sprayberry</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="booked-slot"> <div class="candidate-name">Deana Mcwaters</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="booked-slot"> <div class="candidate-name">Lorenzo Farina</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="unconfirmed-slot"> <div class="candidate-name">Voncile Sobers</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="2"> <div class="booked-slot"> <div class="candidate-name">Gwyneth Marks</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="booked-slot"> <div class="candidate-name">Sommer Barbeau</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="booked-slot"> <div class="candidate-name">Abel Sons</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="unconfirmed-slot"> <div class="candidate-name">Laree Villeneuve</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="2"> <div class="unconfirmed-slot"> <div class="candidate-name">Carrol Zak</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Paige Raimondi</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="booked-slot"> <div class="candidate-name">Lesa Vanslyke</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> </tr> <tr> <td data-daycol="1"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> <td data-daycol="2"> <div class="unconfirmed-slot"> <div class="candidate-name">Tricia Reiss</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="3"> <div class="unconfirmed-slot"> <div class="candidate-name">Delaine Harari</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="4"> <div class="booked-slot"> <div class="candidate-name">Tiana Quigley</div> <div class="slot-action"> <a href="#" class="link-unimp locationRemoveCandidate">Remove</a> </div> </div> </td> <td data-daycol="5"> <div class="empty-slot"> <div class="candidate-name">Empty slot</div> <div class="slot-action"> <a href="find-candidate.html" class="link-unimp locationAddCandidate">Add candidate</a> <a href="#" class="link-unimp locationPlaceCandidate toggle-content">Place candidate</a> </div> </div> </td> </tr> <tr> <td></td> <td data-daycol="1"> <a href="schedule-extract.html" class="button button-extractcol toggle-content locationExtractDay">Extract schedule list</a> </td> <td data-daycol="2"> </td> <td data-daycol="3"> </td> <td data-daycol="4"> </td> <td data-daycol="5"> </td> </tr> </tbody> </table> <!-- <a href="" class="button">Save schedule</a> --> </main> </div> <footer class="gov-border" role="contentinfo"> <div class="footer__wrapper"> <div class="footer__meta"> <ul class="footer__nav" role="navigation"> <li class="footer__ogl hide-print"><a href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3" class="ir ogl-logo">OGL</a>All content is available under the <a href="http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3">Open Government Licence v3.0</a>, except where otherwise stated</li> </ul> <a class="footer__copyright" href="http://www.nationalarchives.gov.uk/information-management/our-services/crown-copyright.htm" target="_blank"> <img src="../_assets/img/govuk-crest-2x.png" width="125" height="102" alt="Crown copyright logo"> <p>&copy; Crown copyright</p> </a> <p data-notice="This is just for the protoype!"><a href="/">Back to start</a></p> </div> </div> </footer> <script src="../_assets/js/vendor/fastclick.js"></script> <script src="../_assets/js/vendor/chosen.jquery.js"></script> <script src="../_assets/js/scripts.js"></script> <!-- Prototype specific scripts --> <script src="../_assets/js/vendor/jquery.cookie.js"></script> <script src="../_assets/js/prototype.js"></script> </body> </html>
{ "content_hash": "5effe75794862e0c9f5432511f17c119", "timestamp": "", "source": "github", "line_count": 709, "max_line_length": 341, "avg_line_length": 37.25952045133992, "alnum_prop": 0.5533557936177461, "repo_name": "charge-valtech/faststream-prototype", "id": "653a4af8e5ef3c2d074768deaf25d035a4a62d22", "size": "26418", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "www/admin/location-schedule-old.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13078" }, { "name": "HTML", "bytes": "3589458" }, { "name": "JavaScript", "bytes": "184419" } ], "symlink_target": "" }
<?php # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads/v12/services/ad_group_customizer_service.proto namespace Google\Ads\GoogleAds\V12\Services; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** * The result for the ad group customizer mutate. * * Generated from protobuf message <code>google.ads.googleads.v12.services.MutateAdGroupCustomizerResult</code> */ class MutateAdGroupCustomizerResult extends \Google\Protobuf\Internal\Message { /** * Returned for successful operations. * * Generated from protobuf field <code>string resource_name = 1 [(.google.api.resource_reference) = {</code> */ protected $resource_name = ''; /** * The mutated AdGroupCustomizer with only mutable fields after mutate. * The field will only be returned when response_content_type is set to * "MUTABLE_RESOURCE". * * Generated from protobuf field <code>.google.ads.googleads.v12.resources.AdGroupCustomizer ad_group_customizer = 2;</code> */ protected $ad_group_customizer = null; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $resource_name * Returned for successful operations. * @type \Google\Ads\GoogleAds\V12\Resources\AdGroupCustomizer $ad_group_customizer * The mutated AdGroupCustomizer with only mutable fields after mutate. * The field will only be returned when response_content_type is set to * "MUTABLE_RESOURCE". * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Ads\GoogleAds\V12\Services\AdGroupCustomizerService::initOnce(); parent::__construct($data); } /** * Returned for successful operations. * * Generated from protobuf field <code>string resource_name = 1 [(.google.api.resource_reference) = {</code> * @return string */ public function getResourceName() { return $this->resource_name; } /** * Returned for successful operations. * * Generated from protobuf field <code>string resource_name = 1 [(.google.api.resource_reference) = {</code> * @param string $var * @return $this */ public function setResourceName($var) { GPBUtil::checkString($var, True); $this->resource_name = $var; return $this; } /** * The mutated AdGroupCustomizer with only mutable fields after mutate. * The field will only be returned when response_content_type is set to * "MUTABLE_RESOURCE". * * Generated from protobuf field <code>.google.ads.googleads.v12.resources.AdGroupCustomizer ad_group_customizer = 2;</code> * @return \Google\Ads\GoogleAds\V12\Resources\AdGroupCustomizer|null */ public function getAdGroupCustomizer() { return $this->ad_group_customizer; } public function hasAdGroupCustomizer() { return isset($this->ad_group_customizer); } public function clearAdGroupCustomizer() { unset($this->ad_group_customizer); } /** * The mutated AdGroupCustomizer with only mutable fields after mutate. * The field will only be returned when response_content_type is set to * "MUTABLE_RESOURCE". * * Generated from protobuf field <code>.google.ads.googleads.v12.resources.AdGroupCustomizer ad_group_customizer = 2;</code> * @param \Google\Ads\GoogleAds\V12\Resources\AdGroupCustomizer $var * @return $this */ public function setAdGroupCustomizer($var) { GPBUtil::checkMessage($var, \Google\Ads\GoogleAds\V12\Resources\AdGroupCustomizer::class); $this->ad_group_customizer = $var; return $this; } }
{ "content_hash": "4c05eb64e20f1ddcef31385f998a4053", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 128, "avg_line_length": 32.890756302521005, "alnum_prop": 0.6617271333673991, "repo_name": "googleads/google-ads-php", "id": "6866faf2cdf7ab27b0b51a1517bd2cd2fe96da92", "size": "3914", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/Google/Ads/GoogleAds/V12/Services/MutateAdGroupCustomizerResult.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "899" }, { "name": "PHP", "bytes": "9952711" }, { "name": "Shell", "bytes": "338" } ], "symlink_target": "" }
require "rubygems" # Test coverage require "simplecov" require "coveralls" SimpleCov.start do add_filter "/test/" end Coveralls.wear! # Comment out this line to have the local coverage generated. require "codeclimate-test-reporter" CodeClimate::TestReporter.start require "minitest/autorun" require "minitest/reporters" MiniTest::Reporters.use! require "active_support/test_case" require "action_controller" require "action_controller/test_case" require "shoulda" require "shoulda-context" require "shoulda-matchers" require "mocha/mini_test" # Make the code to be tested easy to load. $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib")) # Database setup require "active_record" require "logger" ActiveRecord::Base.logger = Logger.new(STDERR) ActiveRecord::Base.logger.level = Logger::WARN ActiveRecord::Base.configurations = {"sqlite3" => {adapter: "sqlite3", database: ":memory:"}} ActiveRecord::Base.establish_connection(:sqlite3) # Models setup. require "validation_auditor" ActiveRecord::Schema.define(version: 0) do create_table :audited_records do |t| t.string :name t.string :email end create_table :non_audited_records do |t| t.string :name t.string :email end end class AuditedRecord < ActiveRecord::Base audit_validation_errors validates :email, presence: true end class NonAuditedRecord < ActiveRecord::Base validates :email, presence: true end require "generators/validation_auditor/templates/migration" CreateValidationAudits.migrate("up") # Shutup. I18n.enforce_available_locales = false # TODO: remove this line when it's not needed anymore. require "assert_difference" class ActiveSupport::TestCase include AssertDifference end ActiveSupport.test_order = :random if ActiveSupport.respond_to?(:test_order=) # Rails 4.2 raises a warning without this because Rails 5.0 changes from :sorted to :random
{ "content_hash": "26ee1e37219b313468ccff3afff91a72", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 169, "avg_line_length": 28.597014925373134, "alnum_prop": 0.7651356993736952, "repo_name": "pupeno/validation_auditor", "id": "e4cfc3c012db8bc90f1280da46ec3047885c9d12", "size": "1971", "binary": false, "copies": "1", "ref": "refs/heads/modernize", "path": "test/test_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "22697" } ], "symlink_target": "" }
UnscentedKalmanFilter ===================== Introduction and Overview ------------------------- This implements the unscented Kalman filter. .. automodule:: filterpy.kalman -------- .. autoclass:: UnscentedKalmanFilter :members: .. automethod:: __init__ -------- .. autoclass:: MerweScaledSigmaPoints :members: .. automethod:: __init__ -------- .. autoclass:: JulierSigmaPoints :members: .. automethod:: __init__ -------- .. autoclass:: SimplexSigmaPoints :members: .. automethod:: __init__
{ "content_hash": "6791252ff774f6ee322cc01bf9ac6ebc", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 45, "avg_line_length": 12.155555555555555, "alnum_prop": 0.5557586837294333, "repo_name": "rlabbe/filterpy", "id": "d4c0abc408a0fe4ef658051a66af5b84bedc95b6", "size": "547", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "docs/kalman/UnscentedKalmanFilter.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "472" }, { "name": "Python", "bytes": "508002" }, { "name": "Shell", "bytes": "674" } ], "symlink_target": "" }
#include "core/html/HTMLShadowElement.h" #include "core/HTMLNames.h" #include "core/dom/Document.h" #include "core/dom/shadow/ShadowRoot.h" #include "core/inspector/ConsoleMessage.h" namespace blink { class Document; inline HTMLShadowElement::HTMLShadowElement(Document& document) : InsertionPoint(HTMLNames::shadowTag, document) { } DEFINE_NODE_FACTORY(HTMLShadowElement) HTMLShadowElement::~HTMLShadowElement() { } ShadowRoot* HTMLShadowElement::olderShadowRoot() { ShadowRoot* containingRoot = containingShadowRoot(); if (!containingRoot) return nullptr; updateDistribution(); ShadowRoot* older = containingRoot->olderShadowRoot(); if (!older || !older->isOpenOrV0() || older->shadowInsertionPointOfYoungerShadowRoot() != this) return nullptr; ASSERT(older->isOpenOrV0()); return older; } Node::InsertionNotificationRequest HTMLShadowElement::insertedInto(ContainerNode* insertionPoint) { if (insertionPoint->isConnected()) { // Warn if trying to reproject between user agent and author shadows. ShadowRoot* root = containingShadowRoot(); if (root && root->olderShadowRoot() && root->type() != root->olderShadowRoot()->type()) { String message = String::format("<shadow> doesn't work for %s element host.", root->host().tagName().utf8().data()); document().addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, WarningMessageLevel, message)); } } return InsertionPoint::insertedInto(insertionPoint); } } // namespace blink
{ "content_hash": "cf4f9ad20564547c19387853dc992358", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 128, "avg_line_length": 29.01851851851852, "alnum_prop": 0.7134652201659222, "repo_name": "danakj/chromium", "id": "47bcba6c334c3a638da9e6c0271a8a5b8bf46791", "size": "3129", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "third_party/WebKit/Source/core/html/HTMLShadowElement.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
import { YearMonth, ZoneId } from "js-joda"; import * as React from "react"; import { connect } from "react-redux"; import { routeNodeSelector, RouterState } from "redux-router5"; import Footer from "./components/Footer"; import Header from "./components/Header"; import Artist from "./pages/Artist"; import ArtistMemberships from "./pages/ArtistMemberships"; import Calendar from "./pages/Calendar"; import EditArtist from "./pages/EditArtist"; import Home from "./pages/Home"; import NewArtist from "./pages/NewArtist"; import NewRelease from "./pages/NewRelease"; import Release from "./pages/Release"; import Search from "./pages/Search"; import Song from "./pages/Song"; type Props = RouterState; class App extends React.Component<Props> { public render() { const { route } = this.props; if (!route) { return <p>Routing failed</p>; } const params = route.params as any; let content; switch (route.name) { case "home": content = <Home />; break; case "artist": content = <Artist id={params.id} />; break; case "artists-edit": content = <EditArtist id={params.id} />; break; case "artists-memberships": content = <ArtistMemberships id={params.id} />; break; case "artists-new": content = <NewArtist />; break; case "release": content = <Release id={params.id} />; break; case "release-new": content = <NewRelease />; break; case "song": content = <Song id={params.id} />; break; case "calendar": const date = params.date || YearMonth.now(ZoneId.UTC).toString(); content = <Calendar date={date} />; break; case "search": content = <Search query={params.query} />; break; default: content = <p>Page not found.</p>; break; } return ( <div> <Header /> {content} <Footer /> </div> ); } } export default connect(routeNodeSelector(""))(App);
{ "content_hash": "70b148a509afbc4d81abbba04b32be17", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 81, "avg_line_length": 30.1375, "alnum_prop": 0.5068436333471589, "repo_name": "zaeleus/lp-web", "id": "d46a22fcd6878ed92deabd0e3ac5f959a26b91e8", "size": "2411", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/App.tsx", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "6478" }, { "name": "HTML", "bytes": "1130" }, { "name": "TypeScript", "bytes": "112930" } ], "symlink_target": "" }
namespace GAME { class Chunk { public: glm::vec2 position; // x:[ y:[ z:[GAME::Entity, ...], [GAME::Entity, ...]], [...]] std::vector<std::vector<std::vector<GAME::Entity>>> groundEntities; Chunk(int pos_x = 0, int pos_t = 0); void generate(Constants & constants, TextureStorage & textureStorage, Assets_uv & assets_uv, cge::Hitbox & wallBox); void renderLayer(unsigned int layer, cge::SpriteBatch & spritebatch); void renderLayerBelowOrEqual(unsigned int layer, cge::SpriteBatch & spritebatch); void translate(int trans_x, int trans_y); void translateTo(int trans_x, int trans_y); }; }
{ "content_hash": "da91b7fa53548a14a437639727de6468", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 120, "avg_line_length": 25.64, "alnum_prop": 0.6505460218408736, "repo_name": "Aelto/opengl-cge", "id": "fe74d682260b1148846fb8dab6cbda6914087db4", "size": "905", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "game/game/classes/world/Chunk.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "640" }, { "name": "C++", "bytes": "80353" } ], "symlink_target": "" }
import unittest import copy import re from music21 import exceptions21 from music21 import pitch shorthandNotation = {(None,) : (5,3), (5,) : (5,3), (6,) : (6,3), (7,) : (7,5,3), (9,) : (9,7,5,3), (11,) : (11,9,7,5,3), (13,) : (13,11,9,7,5,3), (6,5) : (6,5,3), (4,3) : (6,4,3), (4,2) : (6,4,2), (2,) : (6,4,2), } class Notation(object): ''' Breaks apart and stores the information in a figured bass notation column, which is a string of figures, each associated with a number and an optional modifier. The figures are delimited using commas. Examples include "7,5,#3", "6,4", and "6,4+,2". Valid modifiers include those accepted by :class:`~music21.pitch.Accidental`, such as #, -, and n, as well as those which can correspond to one, such as +, /, and b. .. note:: If a figure has a modifier but no number, the number is assumed to be 3. Notation also translates many forms of shorthand notation into longhand. It understands all the forms of shorthand notation listed below. This is true even if a number is accompanied by a modifier, or if a stand-alone modifier implies a 3. * None, "" or "5" -> "5,3" * "6" -> "6,3" * "7" -> "7,5,3" * "6,5" -> "6,5,3" * "4,3" -> "6,4,3" * "4,2" or "2" -> "6,4,2" * "9" -> "9,7,5,3" * "11" -> "11,9,7,5,3" * "13" -> "13,11,9,7,5,3" Figures are saved in order from left to right as found in the notationColumn. >>> from music21.figuredBass import notation >>> n1 = notation.Notation("4+,2") >>> n1.notationColumn '4+,2' >>> n1.figureStrings ['4+', '2'] >>> n1.origNumbers (4, 2) >>> n1.origModStrings ('+', None) >>> n1.numbers (6, 4, 2) >>> n1.modifierStrings (None, '+', None) >>> n1.modifiers (<modifier None None>, <modifier + <accidental sharp>>, <modifier None None>) >>> n1.figures[0] <music21.figuredBass.notation Figure 6 <modifier None None>> >>> n1.figures[1] <music21.figuredBass.notation Figure 4 <modifier + <accidental sharp>>> >>> n1.figures[2] <music21.figuredBass.notation Figure 2 <modifier None None>> Here, a stand-alone # is being passed to Notation. >>> n2 = notation.Notation("#") >>> n2.numbers (5, 3) >>> n2.modifiers (<modifier None None>, <modifier # <accidental sharp>>) >>> n2.figures[0] <music21.figuredBass.notation Figure 5 <modifier None None>> >>> n2.figures[1] <music21.figuredBass.notation Figure 3 <modifier # <accidental sharp>>> Now, a stand-alone b is being passed to Notation as part of a larger notationColumn. >>> n3 = notation.Notation("b6,b") >>> n3.numbers (6, 3) >>> n3.modifiers (<modifier b <accidental flat>>, <modifier b <accidental flat>>) >>> n3.figures[0] <music21.figuredBass.notation Figure 6 <modifier b <accidental flat>>> >>> n3.figures[1] <music21.figuredBass.notation Figure 3 <modifier b <accidental flat>>> ''' _DOC_ORDER = ['notationColumn', 'figureStrings', 'numbers', 'modifiers', 'figures', 'origNumbers', 'origModStrings', 'modifierStrings'] _DOC_ATTR = {'modifiers': 'A list of :class:`~music21.figuredBass.notation.Modifier` objects associated with the expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`.', 'notationColumn': 'A string of figures delimited by commas, each associated with a number and an optional modifier.', 'modifierStrings': 'The modifiers associated with the expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`, as strings.', 'figureStrings': 'A list of figures derived from the original :attr:`~music21.figuredBass.notation.Notation.notationColumn`.', 'origNumbers': 'The numbers associated with the original :attr:`~music21.figuredBass.notation.Notation.notationColumn`.', 'numbers': 'The numbers associated with the expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`.', 'origModStrings': 'The modifiers associated with the original :attr:`~music21.figuredBass.notation.Notation.notationColumn`, as strings.', 'figures': 'A list of :class:`~music21.figuredBass.notation.Figure` objects associated with figures in the expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`.'} def __init__(self, notationColumn = None): #Parse notation string if notationColumn == None: notationColumn = "" self.notationColumn = notationColumn self.figureStrings = None self.origNumbers = None self.origModStrings = None self.numbers = None self.modifierStrings = None self._parseNotationColumn() self._translateToLonghand() #Convert to convenient notation self.modifiers = None self.figures = None self._getModifiers() self._getFigures() def _parseNotationColumn(self): ''' Given a notation column below a pitch, defines both self.numbers and self.modifierStrings, which provide the intervals above the bass and (if necessary) how to modify the corresponding pitches accordingly. >>> from music21.figuredBass import notation as n >>> notation1 = n.Notation('#6,5') #__init__ method calls _parseNotationColumn() >>> notation1.figureStrings ['#6', '5'] >>> notation1.origNumbers (6, 5) >>> notation1.origModStrings ('#', None) >>> notation2 = n.Notation('-6,-') >>> notation2.figureStrings ['-6', '-'] >>> notation2.origNumbers (6, None) >>> notation2.origModStrings ('-', '-') ''' delimiter = '[,]' figures = re.split(delimiter, self.notationColumn) patternA1 = '([0-9]*)' patternA2 = '([^0-9]*)' numbers = [] modifierStrings = [] figureStrings = [] for figure in figures: figure = figure.strip() figureStrings.append(figure) m1 = re.findall(patternA1, figure) m2 = re.findall(patternA2, figure) for i in range(m1.count('')): m1.remove('') for i in range(m2.count('')): m2.remove('') if not (len(m1) <= 1 or len(m2) <= 1): raise NotationException("Invalid Notation: " + figure) number = None modifierString = None if not len(m1) == 0: number = int(m1[0].strip()) if not len(m2) == 0: modifierString = m2[0].strip() numbers.append(number) modifierStrings.append(modifierString) numbers = tuple(numbers) modifierStrings = tuple(modifierStrings) self.origNumbers = numbers #Keep original numbers self.numbers = numbers #Will be converted to longhand self.origModStrings = modifierStrings #Keep original modifier strings self.modifierStrings = modifierStrings #Will be converted to longhand self.figureStrings = figureStrings def _translateToLonghand(self): ''' Provided the numbers and modifierStrings of a parsed notation column, translates it to longhand. >>> from music21.figuredBass import notation as n >>> notation1 = n.Notation('#6,5') #__init__ method calls _parseNotationColumn() >>> str(notation1.origNumbers) + " -> " + str(notation1.numbers) '(6, 5) -> (6, 5, 3)' >>> str(notation1.origModStrings) + " -> " + str(notation1.modifierStrings) "('#', None) -> ('#', None, None)" >>> notation2 = n.Notation('-6,-') >>> notation2.numbers (6, 3) >>> notation2.modifierStrings ('-', '-') ''' oldNumbers = self.numbers newNumbers = oldNumbers oldModifierStrings = self.modifierStrings newModifierStrings = oldModifierStrings try: newNumbers = shorthandNotation[oldNumbers] newModifierStrings = [] oldNumbers = list(oldNumbers) temp = [] for number in oldNumbers: if number == None: temp.append(3) else: temp.append(number) oldNumbers = tuple(temp) for number in newNumbers: newModifierString = None if number in oldNumbers: modifierStringIndex = oldNumbers.index(number) newModifierString = oldModifierStrings[modifierStringIndex] newModifierStrings.append(newModifierString) newModifierStrings = tuple(newModifierStrings) except KeyError: newNumbers = list(newNumbers) temp = [] for number in newNumbers: if number == None: temp.append(3) else: temp.append(number) newNumbers = tuple(temp) self.numbers = newNumbers self.modifierStrings = newModifierStrings def _getModifiers(self): ''' Turns the modifier strings into Modifier objects. A modifier object keeps track of both the modifier string and its corresponding pitch Accidental. >>> from music21.figuredBass import notation as n >>> notation1 = n.Notation('#4,2+') #__init__ method calls _getModifiers() >>> notation1.modifiers[0] <modifier None None> >>> notation1.modifiers[1] <modifier # <accidental sharp>> >>> notation1.modifiers[2] <modifier + <accidental sharp>> ''' modifiers = [] for i in range(len(self.numbers)): modifierString = self.modifierStrings[i] modifier = Modifier(modifierString) modifiers.append(modifier) self.modifiers = tuple(modifiers) def _getFigures(self): ''' Turns the numbers and Modifier objects into Figure objects, each corresponding to a number with its Modifier. >>> from music21.figuredBass import notation as n >>> notation2 = n.Notation('-6,-') #__init__ method calls _getFigures() >>> notation2.figures[0] <music21.figuredBass.notation Figure 6 <modifier - <accidental flat>>> >>> notation2.figures[1] <music21.figuredBass.notation Figure 3 <modifier - <accidental flat>>> ''' figures = [] for i in range(len(self.numbers)): number = self.numbers[i] modifierString = self.modifierStrings[i] figure = Figure(number, modifierString) figures.append(figure) self.figures = figures class NotationException(exceptions21.Music21Exception): pass #------------------------------------------------------------------------------- class Figure(object): ''' A Figure is created by providing a number and a modifierString. The modifierString is turned into a :class:`~music21.figuredBass.notation.Modifier`, and a ModifierException is raised if the modifierString is not valid. >>> from music21.figuredBass import notation >>> f1 = notation.Figure(4, '+') >>> f1.number 4 >>> f1.modifierString '+' >>> f1.modifier <modifier + <accidental sharp>> >>> f1 <music21.figuredBass.notation Figure 4 <modifier + <accidental sharp>>> ''' _DOC_ATTR = {'number': 'A number associated with an expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`.', 'modifierString': 'A modifier string associated with an expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`.', 'modifier': 'A :class:`~music21.figuredBass.notation.Modifier` associated with an expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`.'} def __init__(self, number = 1, modifierString = None): self.number = number self.modifierString = modifierString self.modifier = Modifier(modifierString) def __repr__(self): return '<music21.figuredBass.notation %s %s %s>' % (self.__class__.__name__, self.number, self.modifier) class FigureException(exceptions21.Music21Exception): pass #------------------------------------------------------------------------------- specialModifiers = {'+' : '#', '/' : '-', '\\' : '#', 'b' : '-', 'bb' : '--', 'bbb' : '---', 'bbbb' : '-----', '++': '##', '+++' : '###', '++++' : '####', } class Modifier(object): ''' Turns a modifierString (a modifier in a :attr:`~music21.figuredBass.notation.Notation.notationColumn`) to an :class:`~music21.pitch.Accidental`. A ModifierException is raised if the modifierString is not valid. Accepted inputs are those accepted by Accidental, as well as the following: * '+' or '\\' -> '#' * 'b' or '/' -> '-' >>> from music21.figuredBass import notation >>> m1a = notation.Modifier("#") >>> m1a.modifierString '#' >>> m1a.accidental <accidental sharp> Providing a + in place of a sharp, we get the same result for the accidental. >>> m2a = notation.Modifier("+") >>> m2a.accidental <accidental sharp> If None or "" is provided for modifierString, then the accidental is None. >>> m2a = notation.Modifier(None) >>> m2a.accidental == None True >>> m2b = notation.Modifier("") >>> m2b.accidental == None True ''' _DOC_ATTR = {'modifierString': 'A modifier string associated with an expanded :attr:`~music21.figuredBass.notation.Notation.notationColumn`.', 'accidental': ' A :class:`~music21.pitch.Accidental` corresponding to :attr:`~music21.figuredBass.notation.Modifier.modifierString`.'} def __init__(self, modifierString = None): self.modifierString = modifierString self.accidental = self._toAccidental() def __repr__(self): return '<modifier %s %s>' % (self.modifierString, self.accidental) def _toAccidental(self): ''' >>> from music21.figuredBass import notation as n >>> m1 = n.Modifier('#') >>> m2 = n.Modifier('-') >>> m3 = n.Modifier('n') >>> m4 = n.Modifier('+') #Raises pitch by semitone >>> m5 = n.Modifier('b') #acceptable for flat since note names not allowed >>> m1.accidental <accidental sharp> >>> m2.accidental <accidental flat> >>> m3.accidental <accidental natural> >>> m4.accidental <accidental sharp> >>> m5.accidental <accidental flat> ''' if self.modifierString == None or len(self.modifierString) == 0: return None a = pitch.Accidental() try: a.set(self.modifierString) except pitch.AccidentalException: try: newModifierString = specialModifiers[self.modifierString] except KeyError: raise ModifierException("Figure modifier unsupported in music21: %s." % self.modifierString) a.set(newModifierString) return a def modifyPitchName(self, pitchNameToAlter): ''' Given a pitch name, modify its accidental given the Modifier's :attr:`~music21.figuredBass.notation.Modifier.accidental`. >>> from music21.figuredBass import notation >>> m1 = notation.Modifier('#') >>> m2 = notation.Modifier('-') >>> m3 = notation.Modifier('n') >>> m1.modifyPitchName('D') # Sharp 'D#' >>> m2.modifyPitchName('F') # Flat 'F-' >>> m3.modifyPitchName('C#') # Natural 'C' ''' pitchToAlter = pitch.Pitch(pitchNameToAlter) self.modifyPitch(pitchToAlter, True) return pitchToAlter.name def modifyPitch(self, pitchToAlter, inPlace=False): ''' Given a :class:`~music21.pitch.Pitch`, modify its :attr:`~music21.pitch.Pitch.accidental` given the Modifier's :attr:`~music21.figuredBass.notation.Modifier.accidental`. >>> from music21 import pitch >>> from music21.figuredBass import notation >>> m1 = notation.Modifier('#') >>> m2 = notation.Modifier('-') >>> m3 = notation.Modifier('n') >>> p1a = pitch.Pitch('D5') >>> m1.modifyPitch(p1a) # Sharp <music21.pitch.Pitch D#5> >>> m2.modifyPitch(p1a) # Flat <music21.pitch.Pitch D-5> >>> p1b = pitch.Pitch('D#5') >>> m3.modifyPitch(p1b) <music21.pitch.Pitch D5> OMIT_FROM_DOCS >>> m4 = notation.Modifier('##') >>> m5 = notation.Modifier('--') >>> p2 = pitch.Pitch('F5') >>> m4.modifyPitch(p2) # Double Sharp <music21.pitch.Pitch F##5> >>> m5.modifyPitch(p2) # Double Flat <music21.pitch.Pitch F--5> ''' if not inPlace: pitchToAlter = copy.deepcopy(pitchToAlter) if self.accidental == None: return pitchToAlter if self.accidental.alter == 0.0: pitchToAlter.accidental = self.accidental else: if pitchToAlter.accidental == None: pitchToAlter.accidental = self.accidental else: newAccidental = pitch.Accidental() newAlter = pitchToAlter.accidental.alter + self.accidental.alter try: newAccidental.set(newAlter) pitchToAlter.accidental = newAccidental except pitch.AccidentalException: raise ModifierException("Resulting pitch accidental unsupported in music21.") return pitchToAlter class ModifierException(exceptions21.Music21Exception): pass #------------------------------------------------------------------------------- # Helper Methods def convertToPitch(pitchString): ''' Converts a pitchString to a :class:`~music21.pitch.Pitch`, only if necessary. This method is identical to the one in :mod:`~music21.figuredBass.realizerScale`. >>> from music21.figuredBass import realizerScale >>> pitchString = 'C5' >>> realizerScale.convertToPitch(pitchString) <music21.pitch.Pitch C5> >>> realizerScale.convertToPitch(pitch.Pitch('E4')) # does nothing <music21.pitch.Pitch E4> ''' if isinstance(pitchString, pitch.Pitch): return pitchString if isinstance(pitchString, str): try: return pitch.Pitch(pitchString) except: raise ValueError("Cannot convert string " + pitchString + " to a music21 Pitch.") raise TypeError("Cannot convert " + pitchString + " to a music21 Pitch.") _DOC_ORDER = [Notation, Figure, Modifier] class Test(unittest.TestCase): def runTest(self): pass if __name__ == "__main__": import music21 music21.mainTest(Test)
{ "content_hash": "f23ce55779f05969a4a84852b84dfc0f", "timestamp": "", "source": "github", "line_count": 567, "max_line_length": 197, "avg_line_length": 35.398589065255734, "alnum_prop": 0.5590653181206716, "repo_name": "arnavd96/Cinemiezer", "id": "1fd7d4bdc72df5b460c5fb9a1945bc6a5589cb2a", "size": "20528", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "myvenv/lib/python3.4/site-packages/music21/figuredBass/notation.py", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "300501" }, { "name": "C++", "bytes": "14430" }, { "name": "CSS", "bytes": "105126" }, { "name": "FORTRAN", "bytes": "3200" }, { "name": "HTML", "bytes": "290903" }, { "name": "JavaScript", "bytes": "154747" }, { "name": "Jupyter Notebook", "bytes": "558334" }, { "name": "Objective-C", "bytes": "567" }, { "name": "Python", "bytes": "37092739" }, { "name": "Shell", "bytes": "3668" }, { "name": "TeX", "bytes": "1527" } ], "symlink_target": "" }
package com.hazelcast.jet.datamodel; import com.hazelcast.test.HazelcastParallelClassRunner; import org.junit.Test; import org.junit.runner.RunWith; import static com.hazelcast.jet.datamodel.Tag.tag; import static com.hazelcast.jet.datamodel.Tag.tag0; import static com.hazelcast.jet.datamodel.Tag.tag1; import static com.hazelcast.jet.datamodel.Tag.tag2; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @RunWith(HazelcastParallelClassRunner.class) public class TagTest { private Tag tag; @Test public void when_factory_then_getWithSpecifiedIndex() { assertEquals(42, tag(42).index()); } @Test public void when_tag012_then_indices012() { assertEquals(0, tag0().index()); assertEquals(1, tag1().index()); assertEquals(2, tag2().index()); } @Test public void when_tagsEqual_then_equalsTrueAndHashCodesEqual() { // Given tag = tag(42); Tag tagB = tag(42); // When - Then assertTrue(tag.equals(tagB)); assertTrue(tag.hashCode() == tagB.hashCode()); } @Test public void when_tagsUnequal_then_equalsFalse() { // Given tag = tag(41); Tag tagB = tag(42); // When - Then assertFalse(tag.equals(tagB)); } @Test public void compareTo_ordersByIndex() { assertTrue(tag(42).compareTo(tag(43)) < 0); assertTrue(tag(42).compareTo(tag(42)) == 0); assertTrue(tag(42).compareTo(tag(41)) > 0); } @Test public void when_toString_then_noFailures() { assertNotNull(tag0().toString()); assertNotNull(tag(42).toString()); } }
{ "content_hash": "c67a013917a600e27b2e5b7508fe5f81", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 67, "avg_line_length": 26.567164179104477, "alnum_prop": 0.652247191011236, "repo_name": "gurbuzali/hazelcast-jet", "id": "d515ede248d75ef77564a50d3309dba60e7166ca", "size": "2405", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "hazelcast-jet-core/src/test/java/com/hazelcast/jet/datamodel/TagTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1568" }, { "name": "Java", "bytes": "3684048" }, { "name": "Shell", "bytes": "12114" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>pymatgen.io.cssr module &#8212; pymatgen 2018.3.14 documentation</title> <link rel="stylesheet" href="_static/proBlue.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript" src="_static/documentation_options.js"></script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <link rel="shortcut icon" href="_static/favicon.ico"/> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-33990148-1']); _gaq.push(['_trackPageview']); </script> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">pymatgen 2018.3.14 documentation</a> &#187;</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="module-pymatgen.io.cssr"> <span id="pymatgen-io-cssr-module"></span><h1>pymatgen.io.cssr module<a class="headerlink" href="#module-pymatgen.io.cssr" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="pymatgen.io.cssr.Cssr"> <em class="property">class </em><code class="descname">Cssr</code><span class="sig-paren">(</span><em>structure</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/cssr.html#Cssr"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.cssr.Cssr" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p> <p>Basic object for working with Cssr file. Right now, only conversion from a Structure to a Cssr file is supported.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>structure</strong> (<em>Structure/IStructure</em>) – A structure to create the Cssr object.</td> </tr> </tbody> </table> <dl class="staticmethod"> <dt id="pymatgen.io.cssr.Cssr.from_file"> <em class="property">static </em><code class="descname">from_file</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/cssr.html#Cssr.from_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.cssr.Cssr.from_file" title="Permalink to this definition">¶</a></dt> <dd><p>Reads a CSSR file to a Cssr object.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<em>str</em>) – Filename to read from.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Cssr object.</td> </tr> </tbody> </table> </dd></dl> <dl class="staticmethod"> <dt id="pymatgen.io.cssr.Cssr.from_string"> <em class="property">static </em><code class="descname">from_string</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/cssr.html#Cssr.from_string"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.cssr.Cssr.from_string" title="Permalink to this definition">¶</a></dt> <dd><p>Reads a string representation to a Cssr object.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>string</strong> (<em>str</em>) – A string representation of a CSSR.</td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Cssr object.</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="pymatgen.io.cssr.Cssr.write_file"> <code class="descname">write_file</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pymatgen/io/cssr.html#Cssr.write_file"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pymatgen.io.cssr.Cssr.write_file" title="Permalink to this definition">¶</a></dt> <dd><p>Write out a CSSR file.</p> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<em>str</em>) – Filename to write to.</td> </tr> </tbody> </table> </dd></dl> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/pymatgen.io.cssr.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <div class="searchformwrapper"> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">pymatgen 2018.3.14 documentation</a> &#187;</li> </ul> </div> <div class="footer" role="contentinfo"> &#169; Copyright 2011, Pymatgen Development Team. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.1. </div> <div class="footer">This page uses <a href="http://analytics.google.com/"> Google Analytics</a> to collect statistics. You can disable it by blocking the JavaScript coming from www.google-analytics.com. <script type="text/javascript"> (function() { var ga = document.createElement('script'); ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; ga.setAttribute('async', 'true'); document.documentElement.firstChild.appendChild(ga); })(); </script> </div> </body> </html>
{ "content_hash": "1ca50111390bc3a1f10b8c8cc9a7855c", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 381, "avg_line_length": 47.45348837209303, "alnum_prop": 0.6521685861308503, "repo_name": "czhengsci/pymatgen", "id": "341635d310ac634a1eeafb59364a28db092b0c63", "size": "8176", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/pymatgen.io.cssr.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "5938" }, { "name": "CSS", "bytes": "7550" }, { "name": "Common Lisp", "bytes": "3029065" }, { "name": "HTML", "bytes": "827" }, { "name": "Makefile", "bytes": "5573" }, { "name": "Perl", "bytes": "229104" }, { "name": "Propeller Spin", "bytes": "4026362" }, { "name": "Python", "bytes": "6706935" }, { "name": "Roff", "bytes": "1135003" } ], "symlink_target": "" }
namespace content { namespace { // Subclass of BrowserAccessibility that counts the number of instances. class CountedBrowserAccessibility : public BrowserAccessibility { public: CountedBrowserAccessibility() { global_obj_count_++; native_ref_count_ = 1; } ~CountedBrowserAccessibility() override { global_obj_count_--; } void NativeAddReference() override { native_ref_count_++; } void NativeReleaseReference() override { native_ref_count_--; if (native_ref_count_ == 0) delete this; } int native_ref_count_; static int global_obj_count_; #if defined(OS_WIN) // Adds some padding to prevent a heap-buffer-overflow when an instance of // this class is casted into a BrowserAccessibilityWin pointer. // http://crbug.com/235508 // TODO(dmazzoni): Fix this properly. static const size_t kDataSize = sizeof(int) + sizeof(BrowserAccessibility); uint8_t padding_[sizeof(BrowserAccessibilityWin) - kDataSize]; #endif }; int CountedBrowserAccessibility::global_obj_count_ = 0; // Factory that creates a CountedBrowserAccessibility. class CountedBrowserAccessibilityFactory : public BrowserAccessibilityFactory { public: ~CountedBrowserAccessibilityFactory() override {} BrowserAccessibility* Create() override { return new CountedBrowserAccessibility(); } }; class TestBrowserAccessibilityDelegate : public BrowserAccessibilityDelegate { public: TestBrowserAccessibilityDelegate() : got_fatal_error_(false) {} void AccessibilitySetFocus(int acc_obj_id) override {} void AccessibilityDoDefaultAction(int acc_obj_id) override {} void AccessibilityShowContextMenu(int acc_obj_id) override {} void AccessibilityScrollToMakeVisible(int acc_obj_id, const gfx::Rect& subfocus) override {} void AccessibilityScrollToPoint(int acc_obj_id, const gfx::Point& point) override {} void AccessibilitySetScrollOffset(int acc_obj_id, const gfx::Point& offset) override {} void AccessibilitySetSelection(int acc_anchor_obj_id, int start_offset, int acc_focus_obj_id, int end_offset) override {} void AccessibilitySetValue(int acc_obj_id, const base::string16& value) override {} bool AccessibilityViewHasFocus() const override { return false; } gfx::Rect AccessibilityGetViewBounds() const override { return gfx::Rect(); } gfx::Point AccessibilityOriginInScreen( const gfx::Rect& bounds) const override { return gfx::Point(); } gfx::Rect AccessibilityTransformToRootCoordSpace( const gfx::Rect& bounds) override { return gfx::Rect(); } SiteInstance* AccessibilityGetSiteInstance() override { return nullptr; } void AccessibilityHitTest(const gfx::Point& point) override {} void AccessibilitySetAccessibilityFocus(int acc_obj_id) override {} void AccessibilityFatalError() override { got_fatal_error_ = true; } gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override { return gfx::kNullAcceleratedWidget; } gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override { return nullptr; } bool got_fatal_error() const { return got_fatal_error_; } void reset_got_fatal_error() { got_fatal_error_ = false; } private: bool got_fatal_error_; }; } // anonymous namespace TEST(BrowserAccessibilityManagerTest, TestNoLeaks) { // Create ui::AXNodeData objects for a simple document tree, // representing the accessibility information used to initialize // BrowserAccessibilityManager. ui::AXNodeData button; button.id = 2; button.SetName("Button"); button.role = ui::AX_ROLE_BUTTON; button.state = 0; ui::AXNodeData checkbox; checkbox.id = 3; checkbox.SetName("Checkbox"); checkbox.role = ui::AX_ROLE_CHECK_BOX; checkbox.state = 0; ui::AXNodeData root; root.id = 1; root.SetName("Document"); root.role = ui::AX_ROLE_ROOT_WEB_AREA; root.state = 0; root.child_ids.push_back(2); root.child_ids.push_back(3); // Construct a BrowserAccessibilityManager with this // ui::AXNodeData tree and a factory for an instance-counting // BrowserAccessibility, and ensure that exactly 3 instances were // created. Note that the manager takes ownership of the factory. CountedBrowserAccessibility::global_obj_count_ = 0; BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, button, checkbox), nullptr, new CountedBrowserAccessibilityFactory()); ASSERT_EQ(3, CountedBrowserAccessibility::global_obj_count_); // Delete the manager and test that all 3 instances are deleted. delete manager; ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); // Construct a manager again, and this time save references to two of // the three nodes in the tree. manager = BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, button, checkbox), nullptr, new CountedBrowserAccessibilityFactory()); ASSERT_EQ(3, CountedBrowserAccessibility::global_obj_count_); CountedBrowserAccessibility* root_accessible = static_cast<CountedBrowserAccessibility*>(manager->GetRoot()); root_accessible->NativeAddReference(); CountedBrowserAccessibility* child1_accessible = static_cast<CountedBrowserAccessibility*>( root_accessible->PlatformGetChild(1)); child1_accessible->NativeAddReference(); // Now delete the manager, and only one of the three nodes in the tree // should be released. delete manager; ASSERT_EQ(2, CountedBrowserAccessibility::global_obj_count_); // Release each of our references and make sure that each one results in // the instance being deleted as its reference count hits zero. root_accessible->NativeReleaseReference(); ASSERT_EQ(1, CountedBrowserAccessibility::global_obj_count_); child1_accessible->NativeReleaseReference(); ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); } TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects) { // Make sure that changes to a subtree reuse as many objects as possible. // Tree 1: // // root // child1 // child2 // child3 ui::AXNodeData tree1_child1; tree1_child1.id = 2; tree1_child1.SetName("Child1"); tree1_child1.role = ui::AX_ROLE_BUTTON; tree1_child1.state = 0; ui::AXNodeData tree1_child2; tree1_child2.id = 3; tree1_child2.SetName("Child2"); tree1_child2.role = ui::AX_ROLE_BUTTON; tree1_child2.state = 0; ui::AXNodeData tree1_child3; tree1_child3.id = 4; tree1_child3.SetName("Child3"); tree1_child3.role = ui::AX_ROLE_BUTTON; tree1_child3.state = 0; ui::AXNodeData tree1_root; tree1_root.id = 1; tree1_root.SetName("Document"); tree1_root.role = ui::AX_ROLE_ROOT_WEB_AREA; tree1_root.state = 0; tree1_root.child_ids.push_back(2); tree1_root.child_ids.push_back(3); tree1_root.child_ids.push_back(4); // Tree 2: // // root // child0 <-- inserted // child1 // child2 // <-- child3 deleted ui::AXNodeData tree2_child0; tree2_child0.id = 5; tree2_child0.SetName("Child0"); tree2_child0.role = ui::AX_ROLE_BUTTON; tree2_child0.state = 0; ui::AXNodeData tree2_root; tree2_root.id = 1; tree2_root.SetName("DocumentChanged"); tree2_root.role = ui::AX_ROLE_ROOT_WEB_AREA; tree2_root.state = 0; tree2_root.child_ids.push_back(5); tree2_root.child_ids.push_back(2); tree2_root.child_ids.push_back(3); // Construct a BrowserAccessibilityManager with tree1. CountedBrowserAccessibility::global_obj_count_ = 0; BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( MakeAXTreeUpdate(tree1_root, tree1_child1, tree1_child2, tree1_child3), nullptr, new CountedBrowserAccessibilityFactory()); ASSERT_EQ(4, CountedBrowserAccessibility::global_obj_count_); // Save references to all of the objects. CountedBrowserAccessibility* root_accessible = static_cast<CountedBrowserAccessibility*>(manager->GetRoot()); root_accessible->NativeAddReference(); CountedBrowserAccessibility* child1_accessible = static_cast<CountedBrowserAccessibility*>( root_accessible->PlatformGetChild(0)); child1_accessible->NativeAddReference(); CountedBrowserAccessibility* child2_accessible = static_cast<CountedBrowserAccessibility*>( root_accessible->PlatformGetChild(1)); child2_accessible->NativeAddReference(); CountedBrowserAccessibility* child3_accessible = static_cast<CountedBrowserAccessibility*>( root_accessible->PlatformGetChild(2)); child3_accessible->NativeAddReference(); // Check the index in parent. EXPECT_EQ(0, child1_accessible->GetIndexInParent()); EXPECT_EQ(1, child2_accessible->GetIndexInParent()); EXPECT_EQ(2, child3_accessible->GetIndexInParent()); // Process a notification containing the changed subtree. std::vector<AXEventNotificationDetails> params; params.push_back(AXEventNotificationDetails()); AXEventNotificationDetails* msg = &params[0]; msg->event_type = ui::AX_EVENT_CHILDREN_CHANGED; msg->update.nodes.push_back(tree2_root); msg->update.nodes.push_back(tree2_child0); msg->id = tree2_root.id; manager->OnAccessibilityEvents(params); // There should be 5 objects now: the 4 from the new tree, plus the // reference to child3 we kept. EXPECT_EQ(5, CountedBrowserAccessibility::global_obj_count_); // Check that our references to the root, child1, and child2 are still valid, // but that the reference to child3 is now invalid. EXPECT_TRUE(root_accessible->instance_active()); EXPECT_TRUE(child1_accessible->instance_active()); EXPECT_TRUE(child2_accessible->instance_active()); EXPECT_FALSE(child3_accessible->instance_active()); // Check that the index in parent has been updated. EXPECT_EQ(1, child1_accessible->GetIndexInParent()); EXPECT_EQ(2, child2_accessible->GetIndexInParent()); // Release our references. The object count should only decrease by 1 // for child3. root_accessible->NativeReleaseReference(); child1_accessible->NativeReleaseReference(); child2_accessible->NativeReleaseReference(); child3_accessible->NativeReleaseReference(); EXPECT_EQ(4, CountedBrowserAccessibility::global_obj_count_); // Delete the manager and make sure all memory is cleaned up. delete manager; ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); } TEST(BrowserAccessibilityManagerTest, TestReuseBrowserAccessibilityObjects2) { // Similar to the test above, but with a more complicated tree. // Tree 1: // // root // container // child1 // grandchild1 // child2 // grandchild2 // child3 // grandchild3 ui::AXNodeData tree1_grandchild1; tree1_grandchild1.id = 4; tree1_grandchild1.SetName("GrandChild1"); tree1_grandchild1.role = ui::AX_ROLE_BUTTON; tree1_grandchild1.state = 0; ui::AXNodeData tree1_child1; tree1_child1.id = 3; tree1_child1.SetName("Child1"); tree1_child1.role = ui::AX_ROLE_BUTTON; tree1_child1.state = 0; tree1_child1.child_ids.push_back(4); ui::AXNodeData tree1_grandchild2; tree1_grandchild2.id = 6; tree1_grandchild2.SetName("GrandChild1"); tree1_grandchild2.role = ui::AX_ROLE_BUTTON; tree1_grandchild2.state = 0; ui::AXNodeData tree1_child2; tree1_child2.id = 5; tree1_child2.SetName("Child2"); tree1_child2.role = ui::AX_ROLE_BUTTON; tree1_child2.state = 0; tree1_child2.child_ids.push_back(6); ui::AXNodeData tree1_grandchild3; tree1_grandchild3.id = 8; tree1_grandchild3.SetName("GrandChild3"); tree1_grandchild3.role = ui::AX_ROLE_BUTTON; tree1_grandchild3.state = 0; ui::AXNodeData tree1_child3; tree1_child3.id = 7; tree1_child3.SetName("Child3"); tree1_child3.role = ui::AX_ROLE_BUTTON; tree1_child3.state = 0; tree1_child3.child_ids.push_back(8); ui::AXNodeData tree1_container; tree1_container.id = 2; tree1_container.SetName("Container"); tree1_container.role = ui::AX_ROLE_GROUP; tree1_container.state = 0; tree1_container.child_ids.push_back(3); tree1_container.child_ids.push_back(5); tree1_container.child_ids.push_back(7); ui::AXNodeData tree1_root; tree1_root.id = 1; tree1_root.SetName("Document"); tree1_root.role = ui::AX_ROLE_ROOT_WEB_AREA; tree1_root.state = 0; tree1_root.child_ids.push_back(2); // Tree 2: // // root // container // child0 <-- inserted // grandchild0 <-- // child1 // grandchild1 // child2 // grandchild2 // <-- child3 (and grandchild3) deleted ui::AXNodeData tree2_grandchild0; tree2_grandchild0.id = 9; tree2_grandchild0.SetName("GrandChild0"); tree2_grandchild0.role = ui::AX_ROLE_BUTTON; tree2_grandchild0.state = 0; ui::AXNodeData tree2_child0; tree2_child0.id = 10; tree2_child0.SetName("Child0"); tree2_child0.role = ui::AX_ROLE_BUTTON; tree2_child0.state = 0; tree2_child0.child_ids.push_back(9); ui::AXNodeData tree2_container; tree2_container.id = 2; tree2_container.SetName("Container"); tree2_container.role = ui::AX_ROLE_GROUP; tree2_container.state = 0; tree2_container.child_ids.push_back(10); tree2_container.child_ids.push_back(3); tree2_container.child_ids.push_back(5); // Construct a BrowserAccessibilityManager with tree1. CountedBrowserAccessibility::global_obj_count_ = 0; BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( MakeAXTreeUpdate(tree1_root, tree1_container, tree1_child1, tree1_grandchild1, tree1_child2, tree1_grandchild2, tree1_child3, tree1_grandchild3), nullptr, new CountedBrowserAccessibilityFactory()); ASSERT_EQ(8, CountedBrowserAccessibility::global_obj_count_); // Save references to some objects. CountedBrowserAccessibility* root_accessible = static_cast<CountedBrowserAccessibility*>(manager->GetRoot()); root_accessible->NativeAddReference(); CountedBrowserAccessibility* container_accessible = static_cast<CountedBrowserAccessibility*>( root_accessible->PlatformGetChild(0)); container_accessible->NativeAddReference(); CountedBrowserAccessibility* child2_accessible = static_cast<CountedBrowserAccessibility*>( container_accessible->PlatformGetChild(1)); child2_accessible->NativeAddReference(); CountedBrowserAccessibility* child3_accessible = static_cast<CountedBrowserAccessibility*>( container_accessible->PlatformGetChild(2)); child3_accessible->NativeAddReference(); // Check the index in parent. EXPECT_EQ(1, child2_accessible->GetIndexInParent()); EXPECT_EQ(2, child3_accessible->GetIndexInParent()); // Process a notification containing the changed subtree rooted at // the container. std::vector<AXEventNotificationDetails> params; params.push_back(AXEventNotificationDetails()); AXEventNotificationDetails* msg = &params[0]; msg->event_type = ui::AX_EVENT_CHILDREN_CHANGED; msg->update.nodes.push_back(tree2_container); msg->update.nodes.push_back(tree2_child0); msg->update.nodes.push_back(tree2_grandchild0); msg->id = tree2_container.id; manager->OnAccessibilityEvents(params); // There should be 9 objects now: the 8 from the new tree, plus the // reference to child3 we kept. EXPECT_EQ(9, CountedBrowserAccessibility::global_obj_count_); // Check that our references to the root and container and child2 are // still valid, but that the reference to child3 is now invalid. EXPECT_TRUE(root_accessible->instance_active()); EXPECT_TRUE(container_accessible->instance_active()); EXPECT_TRUE(child2_accessible->instance_active()); EXPECT_FALSE(child3_accessible->instance_active()); // Ensure that we retain the parent of the detached subtree. EXPECT_EQ(root_accessible, container_accessible->GetParent()); EXPECT_EQ(0, container_accessible->GetIndexInParent()); // Check that the index in parent has been updated. EXPECT_EQ(2, child2_accessible->GetIndexInParent()); // Release our references. The object count should only decrease by 1 // for child3. root_accessible->NativeReleaseReference(); container_accessible->NativeReleaseReference(); child2_accessible->NativeReleaseReference(); child3_accessible->NativeReleaseReference(); EXPECT_EQ(8, CountedBrowserAccessibility::global_obj_count_); // Delete the manager and make sure all memory is cleaned up. delete manager; ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); } TEST(BrowserAccessibilityManagerTest, TestMoveChildUp) { // Tree 1: // // 1 // 2 // 3 // 4 ui::AXNodeData tree1_4; tree1_4.id = 4; tree1_4.state = 0; ui::AXNodeData tree1_3; tree1_3.id = 3; tree1_3.state = 0; tree1_3.child_ids.push_back(4); ui::AXNodeData tree1_2; tree1_2.id = 2; tree1_2.state = 0; ui::AXNodeData tree1_1; tree1_1.id = 1; tree1_1.role = ui::AX_ROLE_ROOT_WEB_AREA; tree1_1.state = 0; tree1_1.child_ids.push_back(2); tree1_1.child_ids.push_back(3); // Tree 2: // // 1 // 4 <-- moves up a level and gains child // 6 <-- new // 5 <-- new ui::AXNodeData tree2_6; tree2_6.id = 6; tree2_6.state = 0; ui::AXNodeData tree2_5; tree2_5.id = 5; tree2_5.state = 0; ui::AXNodeData tree2_4; tree2_4.id = 4; tree2_4.state = 0; tree2_4.child_ids.push_back(6); ui::AXNodeData tree2_1; tree2_1.id = 1; tree2_1.state = 0; tree2_1.child_ids.push_back(4); tree2_1.child_ids.push_back(5); // Construct a BrowserAccessibilityManager with tree1. CountedBrowserAccessibility::global_obj_count_ = 0; BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( MakeAXTreeUpdate(tree1_1, tree1_2, tree1_3, tree1_4), nullptr, new CountedBrowserAccessibilityFactory()); ASSERT_EQ(4, CountedBrowserAccessibility::global_obj_count_); // Process a notification containing the changed subtree. std::vector<AXEventNotificationDetails> params; params.push_back(AXEventNotificationDetails()); AXEventNotificationDetails* msg = &params[0]; msg->event_type = ui::AX_EVENT_CHILDREN_CHANGED; msg->update.nodes.push_back(tree2_1); msg->update.nodes.push_back(tree2_4); msg->update.nodes.push_back(tree2_5); msg->update.nodes.push_back(tree2_6); msg->id = tree2_1.id; manager->OnAccessibilityEvents(params); // There should be 4 objects now. EXPECT_EQ(4, CountedBrowserAccessibility::global_obj_count_); // Delete the manager and make sure all memory is cleaned up. delete manager; ASSERT_EQ(0, CountedBrowserAccessibility::global_obj_count_); } TEST(BrowserAccessibilityManagerTest, TestFatalError) { // Test that BrowserAccessibilityManager raises a fatal error // (which will crash the renderer) if the same id is used in // two places in the tree. ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; root.child_ids.push_back(2); root.child_ids.push_back(2); CountedBrowserAccessibilityFactory* factory = new CountedBrowserAccessibilityFactory(); std::unique_ptr<TestBrowserAccessibilityDelegate> delegate( new TestBrowserAccessibilityDelegate()); std::unique_ptr<BrowserAccessibilityManager> manager; ASSERT_FALSE(delegate->got_fatal_error()); manager.reset(BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root), delegate.get(), factory)); ASSERT_TRUE(delegate->got_fatal_error()); ui::AXNodeData root2; root2.id = 1; root2.role = ui::AX_ROLE_ROOT_WEB_AREA; root2.child_ids.push_back(2); root2.child_ids.push_back(3); ui::AXNodeData child1; child1.id = 2; child1.child_ids.push_back(4); child1.child_ids.push_back(5); ui::AXNodeData child2; child2.id = 3; child2.child_ids.push_back(6); child2.child_ids.push_back(5); // Duplicate ui::AXNodeData grandchild4; grandchild4.id = 4; ui::AXNodeData grandchild5; grandchild5.id = 5; ui::AXNodeData grandchild6; grandchild6.id = 6; delegate->reset_got_fatal_error(); factory = new CountedBrowserAccessibilityFactory(); manager.reset(BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root2, child1, child2, grandchild4, grandchild5, grandchild6), delegate.get(), factory)); ASSERT_TRUE(delegate->got_fatal_error()); } TEST(BrowserAccessibilityManagerTest, BoundsForRange) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData static_text; static_text.id = 2; static_text.SetName("Hello, world."); static_text.role = ui::AX_ROLE_STATIC_TEXT; static_text.location = gfx::RectF(100, 100, 29, 18); root.child_ids.push_back(2); ui::AXNodeData inline_text1; inline_text1.id = 3; inline_text1.SetName("Hello, "); inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text1.location = gfx::RectF(100, 100, 29, 9); inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); std::vector<int32_t> character_offsets1; character_offsets1.push_back(6); // 0 character_offsets1.push_back(11); // 1 character_offsets1.push_back(16); // 2 character_offsets1.push_back(21); // 3 character_offsets1.push_back(26); // 4 character_offsets1.push_back(29); // 5 character_offsets1.push_back(29); // 6 (note that the space has no width) inline_text1.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1); static_text.child_ids.push_back(3); ui::AXNodeData inline_text2; inline_text2.id = 4; inline_text2.SetName("world."); inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text2.location = gfx::RectF(100, 109, 28, 9); inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); std::vector<int32_t> character_offsets2; character_offsets2.push_back(5); character_offsets2.push_back(10); character_offsets2.push_back(15); character_offsets2.push_back(20); character_offsets2.push_back(25); character_offsets2.push_back(28); inline_text2.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2); static_text.child_ids.push_back(4); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, static_text, inline_text1, inline_text2), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); BrowserAccessibility* static_text_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, static_text_accessible); EXPECT_EQ(gfx::Rect(100, 100, 6, 9).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 1).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 26, 9).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 5).ToString()); EXPECT_EQ(gfx::Rect(100, 109, 5, 9).ToString(), static_text_accessible->GetLocalBoundsForRange(7, 1).ToString()); EXPECT_EQ(gfx::Rect(100, 109, 25, 9).ToString(), static_text_accessible->GetLocalBoundsForRange(7, 5).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 29, 18).ToString(), static_text_accessible->GetLocalBoundsForRange(5, 3).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 29, 18).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 13).ToString()); // Note that each child in the parent element is represented by a single // embedded object character and not by its text. // TODO(nektar): Investigate failure on Linux. EXPECT_EQ(gfx::Rect(100, 100, 29, 18).ToString(), root_accessible->GetLocalBoundsForRange(0, 13).ToString()); } TEST(BrowserAccessibilityManagerTest, BoundsForRangeMultiElement) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData static_text; static_text.id = 2; static_text.SetName("ABC"); static_text.role = ui::AX_ROLE_STATIC_TEXT; static_text.location = gfx::RectF(0, 20, 33, 9); root.child_ids.push_back(2); ui::AXNodeData inline_text1; inline_text1.id = 3; inline_text1.SetName("ABC"); inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text1.location = gfx::RectF(0, 20, 33, 9); inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); std::vector<int32_t> character_offsets { 10, 21, 33 }; inline_text1.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets); static_text.child_ids.push_back(3); ui::AXNodeData static_text2; static_text2.id = 4; static_text2.SetName("ABC"); static_text2.role = ui::AX_ROLE_STATIC_TEXT; static_text2.location = gfx::RectF(10, 40, 33, 9); root.child_ids.push_back(4); ui::AXNodeData inline_text2; inline_text2.id = 5; inline_text2.SetName("ABC"); inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text2.location = gfx::RectF(10, 40, 33, 9); inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); inline_text2.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets); static_text2.child_ids.push_back(5); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate( root, static_text, inline_text1, static_text2, inline_text2), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); BrowserAccessibility* static_text_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, static_text_accessible); BrowserAccessibility* static_text_accessible2 = root_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, static_text_accessible); // The first line. EXPECT_EQ(gfx::Rect(0, 20, 33, 9).ToString(), manager->GetLocalBoundsForRange( *static_text_accessible, 0, *static_text_accessible, 3).ToString()); // Part of the first line. EXPECT_EQ(gfx::Rect(0, 20, 21, 9).ToString(), manager->GetLocalBoundsForRange( *static_text_accessible, 0, *static_text_accessible, 2).ToString()); // Part of the first line. EXPECT_EQ(gfx::Rect(10, 20, 23, 9).ToString(), manager->GetLocalBoundsForRange( *static_text_accessible, 1, *static_text_accessible, 3).ToString()); // The second line. EXPECT_EQ(gfx::Rect(10, 40, 33, 9).ToString(), manager->GetLocalBoundsForRange( *static_text_accessible2, 0, *static_text_accessible2, 3).ToString()); // All of both lines. EXPECT_EQ(gfx::Rect(0, 20, 43, 29).ToString(), manager->GetLocalBoundsForRange( *static_text_accessible, 0, *static_text_accessible2, 3).ToString()); // Part of both lines. EXPECT_EQ(gfx::Rect(10, 20, 23, 29).ToString(), manager->GetLocalBoundsForRange( *static_text_accessible, 2, *static_text_accessible2, 1).ToString()); // Part of both lines in reverse order. EXPECT_EQ(gfx::Rect(10, 20, 23, 29).ToString(), manager->GetLocalBoundsForRange( *static_text_accessible2, 1, *static_text_accessible, 2).ToString()); } TEST(BrowserAccessibilityManagerTest, BoundsForRangeBiDi) { // In this example, we assume that the string "123abc" is rendered with // "123" going left-to-right and "abc" going right-to-left. In other // words, on-screen it would look like "123cba". This is possible to // achieve if the source string had unicode control characters // to switch directions. This test doesn't worry about how, though - it just // tests that if something like that were to occur, GetLocalBoundsForRange // returns the correct bounds for different ranges. ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData static_text; static_text.id = 2; static_text.SetName("123abc"); static_text.role = ui::AX_ROLE_STATIC_TEXT; static_text.location = gfx::RectF(100, 100, 60, 20); root.child_ids.push_back(2); ui::AXNodeData inline_text1; inline_text1.id = 3; inline_text1.SetName("123"); inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text1.location = gfx::RectF(100, 100, 30, 20); inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); std::vector<int32_t> character_offsets1; character_offsets1.push_back(10); // 0 character_offsets1.push_back(20); // 1 character_offsets1.push_back(30); // 2 inline_text1.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1); static_text.child_ids.push_back(3); ui::AXNodeData inline_text2; inline_text2.id = 4; inline_text2.SetName("abc"); inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text2.location = gfx::RectF(130, 100, 30, 20); inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_RTL); std::vector<int32_t> character_offsets2; character_offsets2.push_back(10); character_offsets2.push_back(20); character_offsets2.push_back(30); inline_text2.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2); static_text.child_ids.push_back(4); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, static_text, inline_text1, inline_text2), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); BrowserAccessibility* static_text_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, static_text_accessible); EXPECT_EQ(gfx::Rect(100, 100, 60, 20).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 6).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 10, 20).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 1).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 30, 20).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 3).ToString()); EXPECT_EQ(gfx::Rect(150, 100, 10, 20).ToString(), static_text_accessible->GetLocalBoundsForRange(3, 1).ToString()); EXPECT_EQ(gfx::Rect(130, 100, 30, 20).ToString(), static_text_accessible->GetLocalBoundsForRange(3, 3).ToString()); // This range is only two characters, but because of the direction switch // the bounds are as wide as four characters. EXPECT_EQ(gfx::Rect(120, 100, 40, 20).ToString(), static_text_accessible->GetLocalBoundsForRange(2, 2).ToString()); } TEST(BrowserAccessibilityManagerTest, BoundsForRangeScrolledWindow) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; root.AddIntAttribute(ui::AX_ATTR_SCROLL_X, 25); root.AddIntAttribute(ui::AX_ATTR_SCROLL_Y, 50); ui::AXNodeData static_text; static_text.id = 2; static_text.SetName("ABC"); static_text.role = ui::AX_ROLE_STATIC_TEXT; static_text.location = gfx::RectF(100, 100, 16, 9); root.child_ids.push_back(2); ui::AXNodeData inline_text; inline_text.id = 3; inline_text.SetName("ABC"); inline_text.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text.location = gfx::RectF(100, 100, 16, 9); inline_text.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); std::vector<int32_t> character_offsets1; character_offsets1.push_back(6); // 0 character_offsets1.push_back(11); // 1 character_offsets1.push_back(16); // 2 inline_text.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1); static_text.child_ids.push_back(3); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, static_text, inline_text), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); BrowserAccessibility* static_text_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, static_text_accessible); if (manager->UseRootScrollOffsetsWhenComputingBounds()) { EXPECT_EQ(gfx::Rect(75, 50, 16, 9).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 3).ToString()); } else { EXPECT_EQ(gfx::Rect(100, 100, 16, 9).ToString(), static_text_accessible->GetLocalBoundsForRange(0, 3).ToString()); } } TEST(BrowserAccessibilityManagerTest, BoundsForRangeOnParentElement) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; root.child_ids.push_back(2); ui::AXNodeData div; div.id = 2; div.role = ui::AX_ROLE_DIV; div.location = gfx::RectF(100, 100, 100, 20); div.child_ids.push_back(3); div.child_ids.push_back(4); div.child_ids.push_back(5); ui::AXNodeData static_text1; static_text1.id = 3; static_text1.SetName("AB"); static_text1.role = ui::AX_ROLE_STATIC_TEXT; static_text1.location = gfx::RectF(100, 100, 40, 20); static_text1.child_ids.push_back(6); ui::AXNodeData img; img.id = 4; img.SetName("Test image"); img.role = ui::AX_ROLE_IMAGE; img.location = gfx::RectF(140, 100, 20, 20); ui::AXNodeData static_text2; static_text2.id = 5; static_text2.SetName("CD"); static_text2.role = ui::AX_ROLE_STATIC_TEXT; static_text2.location = gfx::RectF(160, 100, 40, 20); static_text2.child_ids.push_back(7); ui::AXNodeData inline_text1; inline_text1.id = 6; inline_text1.SetName("AB"); inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text1.location = gfx::RectF(100, 100, 40, 20); inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); std::vector<int32_t> character_offsets1; character_offsets1.push_back(20); // 0 character_offsets1.push_back(40); // 1 inline_text1.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1); ui::AXNodeData inline_text2; inline_text2.id = 7; inline_text2.SetName("CD"); inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; inline_text2.location = gfx::RectF(160, 100, 40, 20); inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, ui::AX_TEXT_DIRECTION_LTR); std::vector<int32_t> character_offsets2; character_offsets2.push_back(20); // 0 character_offsets2.push_back(40); // 1 inline_text2.AddIntListAttribute( ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, div, static_text1, img, static_text2, inline_text1, inline_text2), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); BrowserAccessibility* div_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, div_accessible); EXPECT_EQ(gfx::Rect(100, 100, 20, 20).ToString(), div_accessible->GetLocalBoundsForRange(0, 1).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 40, 20).ToString(), div_accessible->GetLocalBoundsForRange(0, 2).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 80, 20).ToString(), div_accessible->GetLocalBoundsForRange(0, 4).ToString()); EXPECT_EQ(gfx::Rect(120, 100, 60, 20).ToString(), div_accessible->GetLocalBoundsForRange(1, 3).ToString()); EXPECT_EQ(gfx::Rect(120, 100, 80, 20).ToString(), div_accessible->GetLocalBoundsForRange(1, 4).ToString()); EXPECT_EQ(gfx::Rect(100, 100, 100, 20).ToString(), div_accessible->GetLocalBoundsForRange(0, 5).ToString()); } TEST(BrowserAccessibilityManagerTest, TestNextPreviousInTreeOrder) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData node2; node2.id = 2; root.child_ids.push_back(2); ui::AXNodeData node3; node3.id = 3; root.child_ids.push_back(3); ui::AXNodeData node4; node4.id = 4; node3.child_ids.push_back(4); ui::AXNodeData node5; node5.id = 5; root.child_ids.push_back(5); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, node2, node3, node4, node5), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); ASSERT_EQ(3U, root_accessible->PlatformChildCount()); BrowserAccessibility* node2_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, node2_accessible); BrowserAccessibility* node3_accessible = root_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, node3_accessible); ASSERT_EQ(1U, node3_accessible->PlatformChildCount()); BrowserAccessibility* node4_accessible = node3_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, node4_accessible); BrowserAccessibility* node5_accessible = root_accessible->PlatformGetChild(2); ASSERT_NE(nullptr, node5_accessible); EXPECT_EQ(nullptr, manager->NextInTreeOrder(nullptr)); EXPECT_EQ(node2_accessible, manager->NextInTreeOrder(root_accessible)); EXPECT_EQ(node3_accessible, manager->NextInTreeOrder(node2_accessible)); EXPECT_EQ(node4_accessible, manager->NextInTreeOrder(node3_accessible)); EXPECT_EQ(node5_accessible, manager->NextInTreeOrder(node4_accessible)); EXPECT_EQ(nullptr, manager->NextInTreeOrder(node5_accessible)); EXPECT_EQ(nullptr, manager->PreviousInTreeOrder(nullptr)); EXPECT_EQ(node4_accessible, manager->PreviousInTreeOrder(node5_accessible)); EXPECT_EQ(node3_accessible, manager->PreviousInTreeOrder(node4_accessible)); EXPECT_EQ(node2_accessible, manager->PreviousInTreeOrder(node3_accessible)); EXPECT_EQ(root_accessible, manager->PreviousInTreeOrder(node2_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_EQUAL, BrowserAccessibilityManager::CompareNodes( *root_accessible, *root_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_BEFORE, BrowserAccessibilityManager::CompareNodes( *node2_accessible, *node3_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_AFTER, BrowserAccessibilityManager::CompareNodes( *node3_accessible, *node2_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_BEFORE, BrowserAccessibilityManager::CompareNodes( *node2_accessible, *node4_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_AFTER, BrowserAccessibilityManager::CompareNodes( *node4_accessible, *node2_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_BEFORE, BrowserAccessibilityManager::CompareNodes( *node3_accessible, *node4_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_AFTER, BrowserAccessibilityManager::CompareNodes( *node4_accessible, *node3_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_BEFORE, BrowserAccessibilityManager::CompareNodes( *root_accessible, *node2_accessible)); EXPECT_EQ(ui::AX_TREE_ORDER_AFTER, BrowserAccessibilityManager::CompareNodes( *node2_accessible, *root_accessible)); } TEST(BrowserAccessibilityManagerTest, TestNextPreviousTextOnlyObject) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData node2; node2.id = 2; root.child_ids.push_back(2); ui::AXNodeData text1; text1.id = 3; text1.role = ui::AX_ROLE_STATIC_TEXT; root.child_ids.push_back(3); ui::AXNodeData node3; node3.id = 4; root.child_ids.push_back(4); ui::AXNodeData text2; text2.id = 5; text2.role = ui::AX_ROLE_STATIC_TEXT; node3.child_ids.push_back(5); ui::AXNodeData node4; node4.id = 6; node3.child_ids.push_back(6); ui::AXNodeData text3; text3.id = 7; text3.role = ui::AX_ROLE_STATIC_TEXT; node3.child_ids.push_back(7); ui::AXNodeData node5; node5.id = 8; root.child_ids.push_back(8); ui::AXNodeData text4; text4.id = 9; text4.role = ui::AX_ROLE_LINE_BREAK; node5.child_ids.push_back(9); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, node2, node3, node4, node5, text1, text2, text3, text4), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); ASSERT_EQ(4U, root_accessible->PlatformChildCount()); BrowserAccessibility* node2_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, node2_accessible); BrowserAccessibility* text1_accessible = root_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, text1_accessible); BrowserAccessibility* node3_accessible = root_accessible->PlatformGetChild(2); ASSERT_NE(nullptr, node3_accessible); ASSERT_EQ(3U, node3_accessible->PlatformChildCount()); BrowserAccessibility* text2_accessible = node3_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, text2_accessible); BrowserAccessibility* node4_accessible = node3_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, node4_accessible); BrowserAccessibility* text3_accessible = node3_accessible->PlatformGetChild(2); ASSERT_NE(nullptr, text3_accessible); BrowserAccessibility* node5_accessible = root_accessible->PlatformGetChild(3); ASSERT_NE(nullptr, node5_accessible); ASSERT_EQ(1U, node5_accessible->PlatformChildCount()); BrowserAccessibility* text4_accessible = node5_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, text4_accessible); EXPECT_EQ(nullptr, manager->NextTextOnlyObject(nullptr)); EXPECT_EQ(text1_accessible, manager->NextTextOnlyObject(root_accessible)); EXPECT_EQ(text1_accessible, manager->NextTextOnlyObject(node2_accessible)); EXPECT_EQ(text2_accessible, manager->NextTextOnlyObject(text1_accessible)); EXPECT_EQ(text2_accessible, manager->NextTextOnlyObject(node3_accessible)); EXPECT_EQ(text3_accessible, manager->NextTextOnlyObject(text2_accessible)); EXPECT_EQ(text3_accessible, manager->NextTextOnlyObject(node4_accessible)); EXPECT_EQ(text4_accessible, manager->NextTextOnlyObject(text3_accessible)); EXPECT_EQ(text4_accessible, manager->NextTextOnlyObject(node5_accessible)); EXPECT_EQ(nullptr, manager->NextTextOnlyObject(text4_accessible)); EXPECT_EQ(nullptr, manager->PreviousTextOnlyObject(nullptr)); EXPECT_EQ( text3_accessible, manager->PreviousTextOnlyObject(text4_accessible)); EXPECT_EQ( text3_accessible, manager->PreviousTextOnlyObject(node5_accessible)); EXPECT_EQ( text2_accessible, manager->PreviousTextOnlyObject(text3_accessible)); EXPECT_EQ( text2_accessible, manager->PreviousTextOnlyObject(node4_accessible)); EXPECT_EQ( text1_accessible, manager->PreviousTextOnlyObject(text2_accessible)); EXPECT_EQ( text1_accessible, manager->PreviousTextOnlyObject(node3_accessible)); EXPECT_EQ(nullptr, manager->PreviousTextOnlyObject(node2_accessible)); EXPECT_EQ(nullptr, manager->PreviousTextOnlyObject(root_accessible)); } TEST(BrowserAccessibilityManagerTest, TestFindIndicesInCommonParent) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData div; div.id = 2; div.role = ui::AX_ROLE_DIV; root.child_ids.push_back(div.id); ui::AXNodeData button; button.id = 3; button.role = ui::AX_ROLE_BUTTON; div.child_ids.push_back(button.id); ui::AXNodeData button_text; button_text.id = 4; button_text.role = ui::AX_ROLE_STATIC_TEXT; button_text.SetName("Button"); button.child_ids.push_back(button_text.id); ui::AXNodeData line_break; line_break.id = 5; line_break.role = ui::AX_ROLE_LINE_BREAK; line_break.SetName("\n"); div.child_ids.push_back(line_break.id); ui::AXNodeData paragraph; paragraph.id = 6; paragraph.role = ui::AX_ROLE_PARAGRAPH; root.child_ids.push_back(paragraph.id); ui::AXNodeData paragraph_text; paragraph_text.id = 7; paragraph_text.role = ui::AX_ROLE_STATIC_TEXT; paragraph.child_ids.push_back(paragraph_text.id); ui::AXNodeData paragraph_line1; paragraph_line1.id = 8; paragraph_line1.role = ui::AX_ROLE_INLINE_TEXT_BOX; paragraph_line1.SetName("Hello "); paragraph_text.child_ids.push_back(paragraph_line1.id); ui::AXNodeData paragraph_line2; paragraph_line2.id = 9; paragraph_line2.role = ui::AX_ROLE_INLINE_TEXT_BOX; paragraph_line2.SetName("world."); paragraph_text.child_ids.push_back(paragraph_line2.id); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, div, button, button_text, line_break, paragraph, paragraph_text, paragraph_line1, paragraph_line2), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); ASSERT_EQ(2U, root_accessible->PlatformChildCount()); BrowserAccessibility* div_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, div_accessible); ASSERT_EQ(2U, div_accessible->PlatformChildCount()); BrowserAccessibility* button_accessible = div_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, button_accessible); BrowserAccessibility* button_text_accessible = button_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, button_text_accessible); BrowserAccessibility* line_break_accessible = div_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, line_break_accessible); BrowserAccessibility* paragraph_accessible = root_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, paragraph_accessible); BrowserAccessibility* paragraph_text_accessible = paragraph_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, paragraph_text_accessible); ASSERT_EQ(2U, paragraph_text_accessible->InternalChildCount()); BrowserAccessibility* paragraph_line1_accessible = paragraph_text_accessible->InternalGetChild(0); ASSERT_NE(nullptr, paragraph_line1_accessible); BrowserAccessibility* paragraph_line2_accessible = paragraph_text_accessible->InternalGetChild(1); ASSERT_NE(nullptr, paragraph_line2_accessible); BrowserAccessibility* common_parent = nullptr; int child_index1, child_index2; EXPECT_FALSE(BrowserAccessibilityManager::FindIndicesInCommonParent( *root_accessible, *root_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(nullptr, common_parent); EXPECT_EQ(-1, child_index1); EXPECT_EQ(-1, child_index2); EXPECT_TRUE(BrowserAccessibilityManager::FindIndicesInCommonParent( *div_accessible, *paragraph_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(root_accessible, common_parent); EXPECT_EQ(0, child_index1); EXPECT_EQ(1, child_index2); EXPECT_TRUE(BrowserAccessibilityManager::FindIndicesInCommonParent( *div_accessible, *paragraph_line1_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(root_accessible, common_parent); EXPECT_EQ(0, child_index1); EXPECT_EQ(1, child_index2); EXPECT_TRUE(BrowserAccessibilityManager::FindIndicesInCommonParent( *line_break_accessible, *paragraph_text_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(root_accessible, common_parent); EXPECT_EQ(0, child_index1); EXPECT_EQ(1, child_index2); EXPECT_TRUE(BrowserAccessibilityManager::FindIndicesInCommonParent( *button_text_accessible, *line_break_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(div_accessible, common_parent); EXPECT_EQ(0, child_index1); EXPECT_EQ(1, child_index2); EXPECT_TRUE(BrowserAccessibilityManager::FindIndicesInCommonParent( *paragraph_accessible, *paragraph_line2_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(root_accessible, common_parent); EXPECT_EQ(1, child_index1); EXPECT_EQ(1, child_index2); EXPECT_TRUE(BrowserAccessibilityManager::FindIndicesInCommonParent( *paragraph_text_accessible, *paragraph_line1_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(paragraph_accessible, common_parent); EXPECT_EQ(0, child_index1); EXPECT_EQ(0, child_index2); EXPECT_TRUE(BrowserAccessibilityManager::FindIndicesInCommonParent( *paragraph_line1_accessible, *paragraph_line2_accessible, &common_parent, &child_index1, &child_index2)); EXPECT_EQ(paragraph_text_accessible, common_parent); EXPECT_EQ(0, child_index1); EXPECT_EQ(1, child_index2); } TEST(BrowserAccessibilityManagerTest, TestGetTextForRange) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData div; div.id = 2; div.role = ui::AX_ROLE_DIV; root.child_ids.push_back(div.id); ui::AXNodeData button; button.id = 3; button.role = ui::AX_ROLE_BUTTON; div.child_ids.push_back(button.id); ui::AXNodeData button_text; button_text.id = 4; button_text.role = ui::AX_ROLE_STATIC_TEXT; button_text.SetName("Button"); button.child_ids.push_back(button_text.id); ui::AXNodeData line_break; line_break.id = 5; line_break.role = ui::AX_ROLE_LINE_BREAK; line_break.SetName("\n"); div.child_ids.push_back(line_break.id); ui::AXNodeData paragraph; paragraph.id = 6; paragraph.role = ui::AX_ROLE_PARAGRAPH; root.child_ids.push_back(paragraph.id); ui::AXNodeData paragraph_text; paragraph_text.id = 7; paragraph_text.role = ui::AX_ROLE_STATIC_TEXT; paragraph_text.SetName("Hello world."); paragraph.child_ids.push_back(paragraph_text.id); ui::AXNodeData paragraph_line1; paragraph_line1.id = 8; paragraph_line1.role = ui::AX_ROLE_INLINE_TEXT_BOX; paragraph_line1.SetName("Hello "); paragraph_text.child_ids.push_back(paragraph_line1.id); ui::AXNodeData paragraph_line2; paragraph_line2.id = 9; paragraph_line2.role = ui::AX_ROLE_INLINE_TEXT_BOX; paragraph_line2.SetName("world."); paragraph_text.child_ids.push_back(paragraph_line2.id); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, div, button, button_text, line_break, paragraph, paragraph_text, paragraph_line1, paragraph_line2), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); ASSERT_EQ(2U, root_accessible->PlatformChildCount()); BrowserAccessibility* div_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, div_accessible); ASSERT_EQ(2U, div_accessible->PlatformChildCount()); BrowserAccessibility* button_accessible = div_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, button_accessible); BrowserAccessibility* button_text_accessible = button_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, button_text_accessible); BrowserAccessibility* line_break_accessible = div_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, line_break_accessible); BrowserAccessibility* paragraph_accessible = root_accessible->PlatformGetChild(1); ASSERT_NE(nullptr, paragraph_accessible); BrowserAccessibility* paragraph_text_accessible = paragraph_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, paragraph_text_accessible); ASSERT_EQ(2U, paragraph_text_accessible->InternalChildCount()); BrowserAccessibility* paragraph_line1_accessible = paragraph_text_accessible->InternalGetChild(0); ASSERT_NE(nullptr, paragraph_line1_accessible); BrowserAccessibility* paragraph_line2_accessible = paragraph_text_accessible->InternalGetChild(1); ASSERT_NE(nullptr, paragraph_line2_accessible); std::vector<const BrowserAccessibility*> text_only_objects = BrowserAccessibilityManager::FindTextOnlyObjectsInRange(*root_accessible, *root_accessible); EXPECT_EQ(3U, text_only_objects.size()); EXPECT_EQ(button_text_accessible, text_only_objects[0]); EXPECT_EQ(line_break_accessible, text_only_objects[1]); EXPECT_EQ(paragraph_text_accessible, text_only_objects[2]); text_only_objects = BrowserAccessibilityManager::FindTextOnlyObjectsInRange( *div_accessible, *paragraph_accessible); EXPECT_EQ(3U, text_only_objects.size()); EXPECT_EQ(button_text_accessible, text_only_objects[0]); EXPECT_EQ(line_break_accessible, text_only_objects[1]); EXPECT_EQ(paragraph_text_accessible, text_only_objects[2]); EXPECT_EQ(base::ASCIIToUTF16("Button\nHello world."), BrowserAccessibilityManager::GetTextForRange(*root_accessible, 0, *root_accessible, 19)); EXPECT_EQ(base::ASCIIToUTF16("ton\nHello world."), BrowserAccessibilityManager::GetTextForRange(*root_accessible, 3, *root_accessible, 19)); EXPECT_EQ(base::ASCIIToUTF16("Button\nHello world."), BrowserAccessibilityManager::GetTextForRange( *div_accessible, 0, *paragraph_accessible, 12)); EXPECT_EQ(base::ASCIIToUTF16("ton\nHello world."), BrowserAccessibilityManager::GetTextForRange( *div_accessible, 3, *paragraph_accessible, 12)); EXPECT_EQ(base::ASCIIToUTF16("Button\n"), BrowserAccessibilityManager::GetTextForRange(*div_accessible, 0, *div_accessible, 1)); EXPECT_EQ(base::ASCIIToUTF16("Button\n"), BrowserAccessibilityManager::GetTextForRange( *button_accessible, 0, *line_break_accessible, 1)); EXPECT_EQ(base::ASCIIToUTF16("Hello world."), BrowserAccessibilityManager::GetTextForRange( *paragraph_accessible, 0, *paragraph_accessible, 12)); EXPECT_EQ(base::ASCIIToUTF16("Hello wor"), BrowserAccessibilityManager::GetTextForRange( *paragraph_accessible, 0, *paragraph_accessible, 9)); EXPECT_EQ(base::ASCIIToUTF16("Hello world."), BrowserAccessibilityManager::GetTextForRange( *paragraph_text_accessible, 0, *paragraph_text_accessible, 12)); EXPECT_EQ(base::ASCIIToUTF16(" world."), BrowserAccessibilityManager::GetTextForRange( *paragraph_text_accessible, 5, *paragraph_text_accessible, 12)); EXPECT_EQ(base::ASCIIToUTF16("Hello world."), BrowserAccessibilityManager::GetTextForRange( *paragraph_accessible, 0, *paragraph_text_accessible, 12)); EXPECT_EQ( base::ASCIIToUTF16("Hello "), BrowserAccessibilityManager::GetTextForRange( *paragraph_line1_accessible, 0, *paragraph_line1_accessible, 6)); EXPECT_EQ( base::ASCIIToUTF16("Hello"), BrowserAccessibilityManager::GetTextForRange( *paragraph_line1_accessible, 0, *paragraph_line1_accessible, 5)); EXPECT_EQ( base::ASCIIToUTF16("ello "), BrowserAccessibilityManager::GetTextForRange( *paragraph_line1_accessible, 1, *paragraph_line1_accessible, 6)); EXPECT_EQ( base::ASCIIToUTF16("world."), BrowserAccessibilityManager::GetTextForRange( *paragraph_line2_accessible, 0, *paragraph_line2_accessible, 6)); EXPECT_EQ( base::ASCIIToUTF16("orld"), BrowserAccessibilityManager::GetTextForRange( *paragraph_line2_accessible, 1, *paragraph_line2_accessible, 5)); EXPECT_EQ( base::ASCIIToUTF16("Hello world."), BrowserAccessibilityManager::GetTextForRange( *paragraph_line1_accessible, 0, *paragraph_line2_accessible, 6)); // Start and end positions could be reversed. EXPECT_EQ( base::ASCIIToUTF16("Hello world."), BrowserAccessibilityManager::GetTextForRange( *paragraph_line2_accessible, 6, *paragraph_line1_accessible, 0)); } TEST(BrowserAccessibilityManagerTest, DeletingFocusedNodeDoesNotCrash) { // Create a really simple tree with one root node and one focused child. ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; root.state = 0; root.child_ids.push_back(2); ui::AXNodeData node2; node2.id = 2; ui::AXTreeUpdate initial_state = MakeAXTreeUpdate(root, node2); initial_state.has_tree_data = true; initial_state.tree_data.focus_id = 2; std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( initial_state, nullptr, new CountedBrowserAccessibilityFactory())); ASSERT_EQ(1, manager->GetRoot()->GetId()); ASSERT_EQ(2, manager->GetFocus()->GetId()); // Now replace the tree with a new tree consisting of a single root. ui::AXNodeData root2; root2.id = 3; root2.role = ui::AX_ROLE_ROOT_WEB_AREA; root2.state = 0; std::vector<AXEventNotificationDetails> events2; events2.push_back(AXEventNotificationDetails()); events2[0].update = MakeAXTreeUpdate(root2); events2[0].id = -1; events2[0].event_type = ui::AX_EVENT_NONE; manager->OnAccessibilityEvents(events2); // Make sure that the focused node was updated to the new root and // that this doesn't crash. ASSERT_EQ(3, manager->GetRoot()->GetId()); ASSERT_EQ(3, manager->GetFocus()->GetId()); } TEST(BrowserAccessibilityManagerTest, DeletingFocusedNodeDoesNotCrash2) { // Create a really simple tree with one root node and one focused child. ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; root.state = 0; root.child_ids.push_back(2); root.child_ids.push_back(3); root.child_ids.push_back(4); ui::AXNodeData node2; node2.id = 2; ui::AXNodeData node3; node3.id = 3; node3.state = 0; ui::AXNodeData node4; node4.id = 4; node4.state = 0; ui::AXTreeUpdate initial_state = MakeAXTreeUpdate(root, node2, node3, node4); initial_state.has_tree_data = true; initial_state.tree_data.focus_id = 2; std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( initial_state, nullptr, new CountedBrowserAccessibilityFactory())); ASSERT_EQ(1, manager->GetRoot()->GetId()); ASSERT_EQ(2, manager->GetFocus()->GetId()); // Now replace the tree with a new tree consisting of a single root. ui::AXNodeData root2; root2.id = 3; root2.role = ui::AX_ROLE_ROOT_WEB_AREA; root2.state = 0; // Make an update the explicitly clears the previous root. std::vector<AXEventNotificationDetails> events2; events2.push_back(AXEventNotificationDetails()); events2[0].update = MakeAXTreeUpdate(root2); events2[0].update.node_id_to_clear = 1; events2[0].id = -1; events2[0].event_type = ui::AX_EVENT_NONE; manager->OnAccessibilityEvents(events2); // Make sure that the focused node was updated to the new root and // that this doesn't crash. ASSERT_EQ(3, manager->GetRoot()->GetId()); ASSERT_EQ(3, manager->GetFocus()->GetId()); } TEST(BrowserAccessibilityManagerTest, LineStartBoundary) { ui::AXNodeData root; root.id = 1; root.role = ui::AX_ROLE_ROOT_WEB_AREA; ui::AXNodeData static_text; static_text.id = 2; static_text.SetName("1-2-3-4"); static_text.role = ui::AX_ROLE_STATIC_TEXT; root.child_ids.push_back(2); ui::AXNodeData inline_text1; inline_text1.id = 3; inline_text1.SetName("1-2-"); inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; static_text.child_ids.push_back(3); ui::AXNodeData inline_text2; inline_text2.id = 4; inline_text2.SetName("3-4"); inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; static_text.child_ids.push_back(4); std::unique_ptr<BrowserAccessibilityManager> manager( BrowserAccessibilityManager::Create( MakeAXTreeUpdate(root, static_text, inline_text1, inline_text2), nullptr, new CountedBrowserAccessibilityFactory())); BrowserAccessibility* root_accessible = manager->GetRoot(); ASSERT_NE(nullptr, root_accessible); BrowserAccessibility* static_text_accessible = root_accessible->PlatformGetChild(0); ASSERT_NE(nullptr, static_text_accessible); // If the affinity is downstream, check that we get the second line. ASSERT_EQ(4, static_text_accessible->GetLineStartBoundary( 4, ui::BACKWARDS_DIRECTION, ui::AX_TEXT_AFFINITY_DOWNSTREAM)); ASSERT_EQ(7, static_text_accessible->GetLineStartBoundary( 4, ui::FORWARDS_DIRECTION, ui::AX_TEXT_AFFINITY_DOWNSTREAM)); // If the affinity is upstream, check that we get the second line. ASSERT_EQ(0, static_text_accessible->GetLineStartBoundary( 4, ui::BACKWARDS_DIRECTION, ui::AX_TEXT_AFFINITY_UPSTREAM)); ASSERT_EQ(4, static_text_accessible->GetLineStartBoundary( 4, ui::FORWARDS_DIRECTION, ui::AX_TEXT_AFFINITY_UPSTREAM)); } } // namespace content
{ "content_hash": "b3c007b76d36a0ec0a95b9d456bb1302", "timestamp": "", "source": "github", "line_count": 1658, "max_line_length": 80, "avg_line_length": 37.17008443908323, "alnum_prop": 0.700785357305121, "repo_name": "danakj/chromium", "id": "dfb0cf5d68c5164e54adf0400e4711abe2af2bd4", "size": "62303", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "content/browser/accessibility/browser_accessibility_manager_unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="description" content="Javadoc API documentation for Fresco." /> <link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" /> <title> com.facebook.binaryresource - Fresco API | Fresco </title> <link href="../../../../assets/doclava-developer-docs.css" rel="stylesheet" type="text/css" /> <link href="../../../../assets/customizations.css" rel="stylesheet" type="text/css" /> <script src="../../../../assets/search_autocomplete.js" type="text/javascript"></script> <script src="../../../../assets/jquery-resizable.min.js" type="text/javascript"></script> <script src="../../../../assets/doclava-developer-docs.js" type="text/javascript"></script> <script src="../../../../assets/prettify.js" type="text/javascript"></script> <script type="text/javascript"> setToRoot("../../../", "../../../../assets/"); </script> <script src="../../../../assets/doclava-developer-reference.js" type="text/javascript"></script> <script src="../../../../assets/navtree_data.js" type="text/javascript"></script> <script src="../../../../assets/customizations.js" type="text/javascript"></script> <noscript> <style type="text/css"> html,body{overflow:auto;} #body-content{position:relative; top:0;} #doc-content{overflow:visible;border-left:3px solid #666;} #side-nav{padding:0;} #side-nav .toggle-list ul {display:block;} #resize-packages-nav{border-bottom:3px solid #666;} </style> </noscript> </head> <body class=""> <div id="header"> <div id="headerLeft"> <span id="masthead-title"><a href="../../../packages.html">Fresco</a></span> </div> <div id="headerRight"> <div id="search" > <div id="searchForm"> <form accept-charset="utf-8" class="gsc-search-box" onsubmit="return submit_search()"> <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody> <tr> <td class="gsc-input"> <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off" title="search developer docs" name="q" value="search developer docs" onFocus="search_focus_changed(this, true)" onBlur="search_focus_changed(this, false)" onkeydown="return search_changed(event, true, '../../../')" onkeyup="return search_changed(event, false, '../../../')" /> <div id="search_filtered_div" class="no-display"> <table id="search_filtered" cellspacing=0> </table> </div> </td> <!-- <td class="gsc-search-button"> <input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" /> </td> <td class="gsc-clear-button"> <div title="clear results" class="gsc-clear-button">&nbsp;</div> </td> --> </tr></tbody> </table> </form> </div><!-- searchForm --> </div><!-- search --> </div> </div><!-- header --> <div class="g-section g-tpl-240" id="body-content"> <div class="g-unit g-first side-nav-resizable" id="side-nav"> <div id="swapper"> <div id="nav-panels"> <div id="resize-packages-nav"> <div id="packages-nav"> <div id="index-links"> <a href="../../../packages.html" >Packages</a> | <a href="../../../classes.html" >Classes</a> </div> <ul> <li class="api apilevel-"> <a href="../../../com/facebook/animated/gif/package-summary.html">com.facebook.animated.gif</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/animated/giflite/package-summary.html">com.facebook.animated.giflite</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/animated/giflite/decoder/package-summary.html">com.facebook.animated.giflite.decoder</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/animated/giflite/draw/package-summary.html">com.facebook.animated.giflite.draw</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/animated/giflite/drawable/package-summary.html">com.facebook.animated.giflite.drawable</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/animated/webp/package-summary.html">com.facebook.animated.webp</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/animated/webpdrawable/package-summary.html">com.facebook.animated.webpdrawable</a></li> <li class="selected api apilevel-"> <a href="../../../com/facebook/binaryresource/package-summary.html">com.facebook.binaryresource</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/cache/common/package-summary.html">com.facebook.cache.common</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/cache/disk/package-summary.html">com.facebook.cache.disk</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/callercontext/package-summary.html">com.facebook.callercontext</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/activitylistener/package-summary.html">com.facebook.common.activitylistener</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/disk/package-summary.html">com.facebook.common.disk</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/executors/package-summary.html">com.facebook.common.executors</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/file/package-summary.html">com.facebook.common.file</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/internal/package-summary.html">com.facebook.common.internal</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/lifecycle/package-summary.html">com.facebook.common.lifecycle</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/logging/package-summary.html">com.facebook.common.logging</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/media/package-summary.html">com.facebook.common.media</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/memory/package-summary.html">com.facebook.common.memory</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/references/package-summary.html">com.facebook.common.references</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/statfs/package-summary.html">com.facebook.common.statfs</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/streams/package-summary.html">com.facebook.common.streams</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/time/package-summary.html">com.facebook.common.time</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/util/package-summary.html">com.facebook.common.util</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/common/webp/package-summary.html">com.facebook.common.webp</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/datasource/package-summary.html">com.facebook.datasource</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawable/base/package-summary.html">com.facebook.drawable.base</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/backends/pipeline/package-summary.html">com.facebook.drawee.backends.pipeline</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/backends/pipeline/debug/package-summary.html">com.facebook.drawee.backends.pipeline.debug</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/backends/pipeline/info/package-summary.html">com.facebook.drawee.backends.pipeline.info</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/backends/pipeline/info/internal/package-summary.html">com.facebook.drawee.backends.pipeline.info.internal</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/components/package-summary.html">com.facebook.drawee.components</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/controller/package-summary.html">com.facebook.drawee.controller</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/debug/package-summary.html">com.facebook.drawee.debug</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/debug/listener/package-summary.html">com.facebook.drawee.debug.listener</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/drawable/package-summary.html">com.facebook.drawee.drawable</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/generic/package-summary.html">com.facebook.drawee.generic</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/gestures/package-summary.html">com.facebook.drawee.gestures</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/interfaces/package-summary.html">com.facebook.drawee.interfaces</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/span/package-summary.html">com.facebook.drawee.span</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/drawee/view/package-summary.html">com.facebook.drawee.view</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/backend/package-summary.html">com.facebook.fresco.animation.backend</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/bitmap/package-summary.html">com.facebook.fresco.animation.bitmap</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/bitmap/cache/package-summary.html">com.facebook.fresco.animation.bitmap.cache</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/bitmap/preparation/package-summary.html">com.facebook.fresco.animation.bitmap.preparation</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/bitmap/wrapper/package-summary.html">com.facebook.fresco.animation.bitmap.wrapper</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/drawable/package-summary.html">com.facebook.fresco.animation.drawable</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/drawable/animator/package-summary.html">com.facebook.fresco.animation.drawable.animator</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/factory/package-summary.html">com.facebook.fresco.animation.factory</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/animation/frame/package-summary.html">com.facebook.fresco.animation.frame</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/middleware/package-summary.html">com.facebook.fresco.middleware</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/fresco/ui/common/package-summary.html">com.facebook.fresco.ui.common</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imageformat/package-summary.html">com.facebook.imageformat</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/animated/base/package-summary.html">com.facebook.imagepipeline.animated.base</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/animated/factory/package-summary.html">com.facebook.imagepipeline.animated.factory</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/animated/impl/package-summary.html">com.facebook.imagepipeline.animated.impl</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/animated/util/package-summary.html">com.facebook.imagepipeline.animated.util</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/backends/okhttp3/package-summary.html">com.facebook.imagepipeline.backends.okhttp3</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/backends/volley/package-summary.html">com.facebook.imagepipeline.backends.volley</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/bitmaps/package-summary.html">com.facebook.imagepipeline.bitmaps</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/cache/package-summary.html">com.facebook.imagepipeline.cache</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/common/package-summary.html">com.facebook.imagepipeline.common</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/core/package-summary.html">com.facebook.imagepipeline.core</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/datasource/package-summary.html">com.facebook.imagepipeline.datasource</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/debug/package-summary.html">com.facebook.imagepipeline.debug</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/decoder/package-summary.html">com.facebook.imagepipeline.decoder</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/drawable/package-summary.html">com.facebook.imagepipeline.drawable</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/filter/package-summary.html">com.facebook.imagepipeline.filter</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/image/package-summary.html">com.facebook.imagepipeline.image</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/instrumentation/package-summary.html">com.facebook.imagepipeline.instrumentation</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/listener/package-summary.html">com.facebook.imagepipeline.listener</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/memory/package-summary.html">com.facebook.imagepipeline.memory</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/multiuri/package-summary.html">com.facebook.imagepipeline.multiuri</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/nativecode/package-summary.html">com.facebook.imagepipeline.nativecode</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/platform/package-summary.html">com.facebook.imagepipeline.platform</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/postprocessors/package-summary.html">com.facebook.imagepipeline.postprocessors</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/producers/package-summary.html">com.facebook.imagepipeline.producers</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/request/package-summary.html">com.facebook.imagepipeline.request</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/systrace/package-summary.html">com.facebook.imagepipeline.systrace</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/transcoder/package-summary.html">com.facebook.imagepipeline.transcoder</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imagepipeline/transformation/package-summary.html">com.facebook.imagepipeline.transformation</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/imageutils/package-summary.html">com.facebook.imageutils</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/webpsupport/package-summary.html">com.facebook.webpsupport</a></li> <li class="api apilevel-"> <a href="../../../com/facebook/widget/text/span/package-summary.html">com.facebook.widget.text.span</a></li> </ul><br/> </div> <!-- end packages --> </div> <!-- end resize-packages --> <div id="classes-nav"> <ul> <li><h2>Interfaces</h2> <ul> <li class="api apilevel-"><a href="../../../com/facebook/binaryresource/BinaryResource.html">BinaryResource</a></li> </ul> </li> <li><h2>Classes</h2> <ul> <li class="api apilevel-"><a href="../../../com/facebook/binaryresource/ByteArrayBinaryResource.html">ByteArrayBinaryResource</a></li> <li class="api apilevel-"><a href="../../../com/facebook/binaryresource/FileBinaryResource.html">FileBinaryResource</a></li> </ul> </li> </ul><br/> </div><!-- end classes --> </div><!-- end nav-panels --> <div id="nav-tree" style="display:none"> <div id="index-links"> <a href="../../../packages.html" >Packages</a> | <a href="../../../classes.html" >Classes</a> </div> </div><!-- end nav-tree --> </div><!-- end swapper --> </div> <!-- end side-nav --> <script> if (!isMobile) { //$("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav"); chooseDefaultNav(); if ($("#nav-tree").is(':visible')) { init_default_navtree("../../../"); } else { addLoadEvent(function() { scrollIntoView("packages-nav"); scrollIntoView("classes-nav"); }); } //$("#swapper").css({borderBottom:"2px solid #aaa"}); } else { swapNav(); // tree view should be used on mobile } </script> <div class="g-unit" id="doc-content"> <div id="api-info-block"> <div class="api-level"> </div> </div> <div id="jd-header"> package <h1>com.facebook.binaryresource</h1> </div><!-- end header --> <div id="naMessage"></div> <div id="jd-content" class="api apilevel-"> <h2>Interfaces</h2> <div class="jd-sumtable"> <table class="jd-sumtable-expando"> <tr class="alt-color api apilevel-" > <td class="jd-linkcol"><a href="../../../com/facebook/binaryresource/BinaryResource.html">BinaryResource</a></td> <td class="jd-descrcol" width="100%">&nbsp;</td> </tr> </table> </div> <h2>Classes</h2> <div class="jd-sumtable"> <table class="jd-sumtable-expando"> <tr class="alt-color api apilevel-" > <td class="jd-linkcol"><a href="../../../com/facebook/binaryresource/ByteArrayBinaryResource.html">ByteArrayBinaryResource</a></td> <td class="jd-descrcol" width="100%">A trivial implementation of BinaryResource that wraps a byte array &nbsp;</td> </tr> <tr class=" api apilevel-" > <td class="jd-linkcol"><a href="../../../com/facebook/binaryresource/FileBinaryResource.html">FileBinaryResource</a></td> <td class="jd-descrcol" width="100%">&nbsp;</td> </tr> </table> </div> <div id="footer"> +Generated by <a href="http://code.google.com/p/doclava/">Doclava</a>. +</div> <!-- end footer - @generated --> </div><!-- end jd-content --> </div><!-- doc-content --> </div> <!-- end body-content --> <script type="text/javascript"> init(); /* initialize doclava-developer-docs.js */ </script> </body> </html>
{ "content_hash": "0d11d54f27b6b965e61f53636188befe", "timestamp": "", "source": "github", "line_count": 452, "max_line_length": 296, "avg_line_length": 44.769911504424776, "alnum_prop": 0.628879225143309, "repo_name": "facebook/fresco", "id": "80707c3ee37aa4b9924f5754723bebed59b752ef", "size": "20236", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "docs/javadoc/reference/com/facebook/binaryresource/package-summary.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "53297" }, { "name": "C++", "bytes": "226393" }, { "name": "Java", "bytes": "3181636" }, { "name": "Kotlin", "bytes": "692238" }, { "name": "Makefile", "bytes": "10780" }, { "name": "Python", "bytes": "10096" }, { "name": "Shell", "bytes": "1516" } ], "symlink_target": "" }
name 'open-hackathon-adminUI' maintainer "Microsoft Open Technologies (Shanghai) Co. Ltd" maintainer_email "msopentechdevsh@microsoft.com" license "MIT" description 'Installs/Configures open-hackathon-adminUI' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0' depends 'open-hackathon-api'
{ "content_hash": "095235d2ec8806b8c43444c408175f77", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 72, "avg_line_length": 37.1, "alnum_prop": 0.6954177897574124, "repo_name": "Fendoe/open-hackathon-o", "id": "cbf870eee37deb1c06e858f09628cf54e0d774ae", "size": "1721", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "deploy/chef/chef-repo/cookbooks/open-hackathon-adminUI/metadata.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "109082" }, { "name": "HTML", "bytes": "426116" }, { "name": "Java", "bytes": "12108" }, { "name": "JavaScript", "bytes": "414512" }, { "name": "Python", "bytes": "2270532" }, { "name": "Ruby", "bytes": "1518308" }, { "name": "Shell", "bytes": "18652" } ], "symlink_target": "" }
from django.urls import reverse from rest_framework import status from bluebottle.test.utils import BluebottleTestCase from bluebottle.test.factory_models.accounts import BlueBottleUserFactory from bluebottle.test.factory_models.terms import TermsFactory class TermsAPITest(BluebottleTestCase): """ Integration tests for the Terms API. """ def setUp(self): super(TermsAPITest, self).setUp() self.user_1 = BlueBottleUserFactory.create() self.user_1_token = 'JWT {0}'.format(self.user_1.get_jwt_token()) self.user_2 = BlueBottleUserFactory.create() self.user_2_token = 'JWT {0}'.format(self.user_2.get_jwt_token()) self.terms = TermsFactory.create(contents='Awesome terms!') def test_get_current_terms(self): response = self.client.get(reverse('current-terms')) self.assertEqual(response.data['contents'], self.terms.contents) def test_agree_terms(self): response = self.client.post(reverse('terms-agreement-list'), token=self.user_2_token) self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.data['user'], self.user_2.id) self.assertEqual(response.data['terms'], self.terms.id)
{ "content_hash": "537e0e736c0b2e254ca9d9087dfce447", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 73, "avg_line_length": 36.42857142857143, "alnum_prop": 0.6870588235294117, "repo_name": "onepercentclub/bluebottle", "id": "79df692d291f803133c478a81a596646486c7f54", "size": "1275", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bluebottle/terms/tests/test_api.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "41694" }, { "name": "HTML", "bytes": "246695" }, { "name": "Handlebars", "bytes": "63" }, { "name": "JavaScript", "bytes": "139123" }, { "name": "PHP", "bytes": "35" }, { "name": "PLpgSQL", "bytes": "1369882" }, { "name": "PostScript", "bytes": "2927" }, { "name": "Python", "bytes": "4983116" }, { "name": "Rich Text Format", "bytes": "39109" }, { "name": "SCSS", "bytes": "99555" }, { "name": "Shell", "bytes": "3068" }, { "name": "Smarty", "bytes": "3814" } ], "symlink_target": "" }
package com.blogspot.sontx.chatsocket.client.model.handler; import com.blogspot.sontx.chatsocket.lib.bean.Response; import com.blogspot.sontx.chatsocket.lib.bo.ObjectTransmission; public interface ResponseHandler { void handle(ObjectTransmission transmission, Response response) throws Exception; }
{ "content_hash": "87525cbd254a71e739dfb6a65a1df0e9", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 85, "avg_line_length": 38.125, "alnum_prop": 0.8327868852459016, "repo_name": "sontx/chat-socket", "id": "006cdf79d9ac240674f8dac103df34dd37e28bd6", "size": "305", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/blogspot/sontx/chatsocket/client/model/handler/ResponseHandler.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "104" }, { "name": "CSS", "bytes": "1789" }, { "name": "Java", "bytes": "203860" }, { "name": "Shell", "bytes": "172" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "fab6a7f742c2467310b91042872b1b6d", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "8e46981db7c46dbbab01a50eb9d423140f4615b3", "size": "199", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Cactaceae/Opuntia/Opuntia crispicrinita/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
@interface NextBikeCity : _BicycletteCity <BicycletteCity> @end
{ "content_hash": "d883dc7aaf60c9fbb9481ff027552736", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 58, "avg_line_length": 32, "alnum_prop": 0.8125, "repo_name": "n-b/Bicyclette", "id": "e1730f65489a363ebed077006413ad3aaf46df83", "size": "236", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Files/Cities/NextBikeCity.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "394" }, { "name": "Objective-C", "bytes": "336954" }, { "name": "Shell", "bytes": "523" } ], "symlink_target": "" }
import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Category.cat_image' db.add_column('blogs_category', 'cat_image', self.gf('sorl.thumbnail.fields.ImageField')(max_length=100, null=True, blank=True), keep_default=False) def backwards(self, orm): # Deleting field 'Category.cat_image' db.delete_column('blogs_category', 'cat_image') models = { 'auth.group': { 'Meta': {'object_name': 'Group'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, 'auth.permission': { 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) }, 'auth.user': { 'Meta': {'object_name': 'User'}, 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, 'blogs.blog': { 'Meta': {'object_name': 'Blog'}, 'creator': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'custom_domain': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}), 'description': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}), 'draft_notice': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'facebook_link': ('django.db.models.fields.URLField', [], {'max_length': '100', 'blank': 'True'}), 'has_artists': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'header_image': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_bootblog': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_online': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_open': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'language': ('django.db.models.fields.CharField', [], {'max_length': '7', 'blank': 'True'}), 'main_color': ('django.db.models.fields.CharField', [], {'default': "'#ff7f00'", 'max_length': '10'}), 'moderator_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}), 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '30'}), 'template': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Template']", 'null': 'True', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '240'}), 'translation': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Blog']", 'null': 'True', 'blank': 'True'}), 'twitter_link': ('django.db.models.fields.URLField', [], {'max_length': '100', 'blank': 'True'}), 'twitter_oauth_token': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), 'twitter_oauth_token_secret': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}) }, 'blogs.category': { 'Meta': {'object_name': 'Category'}, 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), 'blog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Blog_category'", 'null': 'True', 'to': "orm['blogs.Blog']"}), 'cat_image': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'color': ('django.db.models.fields.CharField', [], {'default': "'#000000'", 'max_length': '10'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), 'description': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '140', 'null': 'True', 'blank': 'True'}), 'parent_category': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'child_category'", 'null': 'True', 'to': "orm['blogs.Category']"}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '140', 'blank': 'True'}) }, 'blogs.comment': { 'Meta': {'object_name': 'Comment'}, 'author': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'Comment_author'", 'null': 'True', 'to': "orm['auth.User']"}), 'blog': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Blog']", 'null': 'True'}), 'comment': ('django.db.models.fields.TextField', [], {'max_length': '10000'}), 'comment_status': ('django.db.models.fields.CharField', [], {'default': "'pe'", 'max_length': '2'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '140'}), 'notify_me': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'occupation': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), 'post': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Post']", 'null': 'True'}), 'website': ('django.db.models.fields.URLField', [], {'max_length': '300', 'blank': 'True'}) }, 'blogs.info_email': { 'Meta': {'object_name': 'Info_email'}, 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'blog': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Blog']", 'null': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'frequency': ('django.db.models.fields.CharField', [], {'default': "'We'", 'max_length': '2', 'null': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'message': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}), 'status': ('django.db.models.fields.CharField', [], {'max_length': '2'}), 'subject': ('django.db.models.fields.TextField', [], {'max_length': '100', 'blank': 'True'}), 'subscribers': ('django.db.models.fields.CharField', [], {'default': "'A'", 'max_length': '2', 'null': 'True'}) }, 'blogs.language': { 'Meta': {'object_name': 'Language'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '5'}), 'language_name': ('django.db.models.fields.CharField', [], {'max_length': '40'}) }, 'blogs.menu': { 'Meta': {'object_name': 'Menu'}, 'blog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Blog_menu'", 'null': 'True', 'to': "orm['blogs.Blog']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}) }, 'blogs.menuitem': { 'Meta': {'object_name': 'MenuItem'}, 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Category']", 'null': 'True', 'blank': 'True'}), 'external_link': ('django.db.models.fields.URLField', [], {'max_length': '140', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'menu': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Menu']", 'null': 'True'}), 'page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Page']", 'null': 'True', 'blank': 'True'}), 'position': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '40', 'blank': 'True'}) }, 'blogs.page': { 'Meta': {'object_name': 'Page'}, 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'blog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Blog_page'", 'null': 'True', 'to': "orm['blogs.Blog']"}), 'content': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), 'pub_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '140', 'blank': 'True'}), 'status': ('django.db.models.fields.CharField', [], {'max_length': '2'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}) }, 'blogs.post': { 'Meta': {'object_name': 'Post'}, 'artist': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}), 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True'}), 'base62id': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}), 'blog': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Blog']", 'null': 'True'}), 'category': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['blogs.Category']", 'null': 'True', 'blank': 'True'}), 'content': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_0': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_01': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_1': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_2': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_3': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_4': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_5': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_6': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'content_video': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_discarded': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_ready': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), 'is_top': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'karma': ('django.db.models.fields.IntegerField', [], {'default': '0'}), 'last_modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}), 'layout_type': ('django.db.models.fields.CharField', [], {'default': "'s'", 'max_length': '1'}), 'message': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'pic': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_0': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_04': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_1': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_10': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_11': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_12': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_13': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_14': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_15': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_16': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_17': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_18': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_19': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_2': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_20': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_21': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_22': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_23': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_24': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_3': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_4': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_5': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_6': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_7': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_8': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pic_9': ('sorl.thumbnail.fields.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'pub_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), 'publish_on_facebook': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '140', 'blank': 'True'}), 'source': ('django.db.models.fields.URLField', [], {'max_length': '300', 'blank': 'True'}), 'status': ('django.db.models.fields.CharField', [], {'default': "'P'", 'max_length': '2', 'null': 'True'}), 'tag': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['blogs.Tag']", 'null': 'True', 'blank': 'True'}), 'text': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'title': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}), 'translated_content': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'translated_title': ('django.db.models.fields.CharField', [], {'max_length': '140', 'blank': 'True'}), 'video': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'video_ogg': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), 'views': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}), 'youtube_id': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), 'youtube_url': ('django.db.models.fields.URLField', [], {'max_length': '300', 'blank': 'True'}) }, 'blogs.rss': { 'Meta': {'object_name': 'Rss'}, 'blog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Blog_rss'", 'null': 'True', 'to': "orm['blogs.Blog']"}), 'feed_url': ('django.db.models.fields.URLField', [], {'max_length': '300', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) }, 'blogs.subscription': { 'Meta': {'object_name': 'Subscription'}, 'blog': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['blogs.Blog']", 'null': 'True'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'is_new': ('django.db.models.fields.BooleanField', [], {'default': 'True'}) }, 'blogs.tag': { 'Meta': {'object_name': 'Tag'}, 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}), 'blog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Blog_tag'", 'null': 'True', 'to': "orm['blogs.Blog']"}), 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}), 'description': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'null': 'True', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '140', 'null': 'True', 'blank': 'True'}), 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '140'}) }, 'blogs.template': { 'Meta': {'object_name': 'Template'}, 'archives': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'base': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'category': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '60'}), 'single': ('django.db.models.fields.TextField', [], {'max_length': '10000', 'blank': 'True'}) }, 'blogs.translation': { 'Meta': {'object_name': 'Translation'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '40'}), 'origin_blog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Translation_origin_blog'", 'null': 'True', 'to': "orm['blogs.Blog']"}), 'translated_blog': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'Translation_translated_blog'", 'null': 'True', 'to': "orm['blogs.Blog']"}) }, 'contenttypes.contenttype': { 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) } } complete_apps = ['blogs']
{ "content_hash": "99d9b8fe2b1a4ca23e960cf2213e0c8f", "timestamp": "", "source": "github", "line_count": 270, "max_line_length": 184, "avg_line_length": 88.1, "alnum_prop": 0.5366796989952495, "repo_name": "carquois/blobon", "id": "ad5d041d00d3a4a18e880900cc0e7e1b61abe5cf", "size": "23811", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "blobon/blogs/migrations/0092_auto__add_field_category_cat_image.py", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "e9c9d61205fddcafb76d565cc7ee6f7f", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "91e9e6b86d2204497942e0e77f256a336c939f74", "size": "175", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Cactaceae/Cereus/Cereus grusonianus/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package kr.ac.kaist.jsaf.nodes_util // The Completion Specification Type object EJSCompletionType { def isNormal(t: Int): Boolean = t / 10 == 0 // 0x def isAbrupt(t: Int): Boolean = t / 10 == 1 // 1x val NORMAL = 01 val ABRUPT = 10 val BREAK = 11 val RETURN = 12 val THROW = 13 }
{ "content_hash": "17b097e3bcf6e09a6c04e499490aa8ab", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 51, "avg_line_length": 20.266666666666666, "alnum_prop": 0.6282894736842105, "repo_name": "daejunpark/jsaf", "id": "73fddbdf55ae515d89a534f8684bc9dcad1f672e", "size": "645", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/kr/ac/kaist/jsaf/nodes_util/EJSCompletionType.scala", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "379" }, { "name": "C", "bytes": "59067" }, { "name": "C++", "bytes": "13294" }, { "name": "CSS", "bytes": "9351891" }, { "name": "Emacs Lisp", "bytes": "9812" }, { "name": "HTML", "bytes": "19106074" }, { "name": "Jasmin", "bytes": "46" }, { "name": "Java", "bytes": "375421" }, { "name": "JavaScript", "bytes": "51177272" }, { "name": "Makefile", "bytes": "3558" }, { "name": "Objective-C", "bytes": "345276" }, { "name": "Objective-J", "bytes": "4500028" }, { "name": "PHP", "bytes": "12684" }, { "name": "Perl", "bytes": "5278" }, { "name": "Python", "bytes": "75059" }, { "name": "Ruby", "bytes": "22932" }, { "name": "Scala", "bytes": "5542753" }, { "name": "Shell", "bytes": "91018" }, { "name": "VimL", "bytes": "6985" }, { "name": "XML", "bytes": "1288109" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace Neptuo.Formatters.Metadata { partial class ReflectionCompositeTypeProvider { private class PropertyDescriptor { public CompositePropertyAttribute Attribute { get; set; } public PropertyInfo PropertyInfo { get; set; } } } }
{ "content_hash": "e76b1e0fc63f179f30739c560a8b16c4", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 69, "avg_line_length": 24.22222222222222, "alnum_prop": 0.6995412844036697, "repo_name": "maraf/Money", "id": "63428f8d65903b30b1499c656d4cb48b5baa1627", "size": "438", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Neptuo/Formatters/Metadata/ReflectionCompositeTypeProvider.PropertyDescriptor.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "1789628" }, { "name": "CSS", "bytes": "11724" }, { "name": "HTML", "bytes": "99240" }, { "name": "JavaScript", "bytes": "125582" }, { "name": "SCSS", "bytes": "13190" } ], "symlink_target": "" }
EXECUTABLES=git go find docker tar _=$(foreach exec,$(EXECUTABLES), \ $(if $(shell which $(exec)), ok, $(error "No $(exec) in PATH"))) IMAGE=ivan1993spb/snake-server IMAGE_GOLANG=golang:1.14-alpine3.11 IMAGE_ALPINE=alpine:3.11 REPO=github.com/ivan1993spb/snake-server DEFAULT_GOOS=linux DEFAULT_GOARCH=amd64 BINARY_NAME=snake-server VERSION=$(shell git describe --tags --abbrev=0) BUILD=$(shell git rev-parse --short HEAD) PLATFORMS=darwin linux windows ARCHITECTURES=386 amd64 LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.Build=$(BUILD)" DOCKER_BUILD_ARGS=\ --build-arg VERSION=$(VERSION) \ --build-arg BUILD=$(BUILD) \ --build-arg IMAGE_GOLANG=$(IMAGE_GOLANG) \ --build-arg IMAGE_ALPINE=$(IMAGE_ALPINE) default: build docker/build: @docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) . @docker tag $(IMAGE):$(VERSION) $(IMAGE):latest @echo "Build $(BUILD) tagged $(IMAGE):$(VERSION)" @echo "Build $(BUILD) tagged $(IMAGE):latest" docker/push: @echo "Push build $(BUILD) with tag $(IMAGE):$(VERSION)" @docker push $(IMAGE):$(VERSION) @echo "Push build $(BUILD) with tag $(IMAGE):latest" @docker push $(IMAGE):latest go/vet: @docker run --rm -v $(PWD):/go/src/$(REPO) -w /go/src/$(REPO) \ -e CGO_ENABLED=0 $(IMAGE_GOLANG) go vet ./... go/test: @docker run --rm -v $(PWD):/go/src/$(REPO) -w /go/src/$(REPO) \ -e CGO_ENABLED=0 $(IMAGE_GOLANG) \ go test -v -cover ./... go/test/benchmarks: @docker run --rm -v $(PWD):/go/src/$(REPO) -w /go/src/$(REPO) \ -e CGO_ENABLED=0 $(IMAGE_GOLANG) \ go test -bench . -timeout 1h ./... go/build: @docker run --rm -v $(PWD):/go/src/$(REPO) -w /go/src/$(REPO) \ -e GOOS=$(DEFAULT_GOOS) -e GOARCH=$(DEFAULT_GOARCH) \ -e CGO_ENABLED=0 $(IMAGE_GOLANG) \ go build $(LDFLAGS) -v -o $(BINARY_NAME) go/crosscompile: @_=$(foreach GOOS, $(PLATFORMS), \ $(foreach GOARCH, $(ARCHITECTURES), \ $(shell docker run --rm \ -v $(PWD):/go/src/$(REPO) \ -w /go/src/$(REPO) \ -e GOOS=$(GOOS) \ -e GOARCH=$(GOARCH) \ -e CGO_ENABLED=0 \ $(IMAGE_GOLANG) go build $(LDFLAGS) -o $(BINARY_NAME)-$(VERSION)-$(GOOS)-$(GOARCH)) \ ) \ ) @_=$(foreach GOOS, $(PLATFORMS), \ $(foreach GOARCH, $(ARCHITECTURES), \ $(shell tar -zcf \ $(BINARY_NAME)-$(VERSION)-$(GOOS)-$(GOARCH).tar.gz \ --transform="flags=r;s|-$(VERSION)-$(GOOS)-$(GOARCH)||" \ $(BINARY_NAME)-$(VERSION)-$(GOOS)-$(GOARCH)) \ ) \ ) @echo -n build: @go build $(LDFLAGS) -v -o $(BINARY_NAME) install: @go install $(LDFLAGS) -v clean: @find -maxdepth 1 -type f -name '${BINARY_NAME}*' -print -delete coverprofile: @go test -coverprofile=coverage.out ./... @go tool cover -func=coverage.out @go tool cover -html=coverage.out go/generate: @go list ./... | grep -v vendor | xargs go generate -v
{ "content_hash": "165e6f94771f8b2f2d608ecd03a111a9", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 89, "avg_line_length": 27.564356435643564, "alnum_prop": 0.6285919540229885, "repo_name": "ivan1993spb/clever-snake", "id": "b18d0e3f7b77480d8f4cebc0f631fe7e29310bf6", "size": "2785", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Makefile", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Go", "bytes": "54393" } ], "symlink_target": "" }
extern const AP_HAL::HAL& hal; // set_angle_targets - sets angle targets in degrees void AP_Mount_Backend::set_angle_targets(float roll, float tilt, float pan) { // set angle targets _angle_ef_target_rad.x = radians(roll); _angle_ef_target_rad.y = radians(tilt); _angle_ef_target_rad.z = radians(pan); // set the mode to mavlink targeting _frontend.set_mode(_instance, MAV_MOUNT_MODE_MAVLINK_TARGETING); } // set_roi_target - sets target location that mount should attempt to point towards void AP_Mount_Backend::set_roi_target(const struct Location &target_loc) { // set the target gps location _state._roi_target = target_loc; // set the mode to GPS tracking mode _frontend.set_mode(_instance, MAV_MOUNT_MODE_GPS_POINT); } // configure_msg - process MOUNT_CONFIGURE messages received from GCS void AP_Mount_Backend::configure_msg(mavlink_message_t* msg) { __mavlink_mount_configure_t packet; mavlink_msg_mount_configure_decode(msg, &packet); // set mode _frontend.set_mode(_instance,(enum MAV_MOUNT_MODE)packet.mount_mode); // set which axis are stabilized _state._stab_roll = packet.stab_roll; _state._stab_tilt = packet.stab_pitch; _state._stab_pan = packet.stab_yaw; } // control_msg - process MOUNT_CONTROL messages received from GCS void AP_Mount_Backend::control_msg(mavlink_message_t *msg) { __mavlink_mount_control_t packet; mavlink_msg_mount_control_decode(msg, &packet); // interpret message fields based on mode switch (_frontend.get_mode(_instance)) { case MAV_MOUNT_MODE_RETRACT: case MAV_MOUNT_MODE_NEUTRAL: // do nothing with request if mount is retracted or in neutral position break; // set earth frame target angles from mavlink message case MAV_MOUNT_MODE_MAVLINK_TARGETING: set_angle_targets(packet.input_b*0.01f, packet.input_a*0.01f, packet.input_c*0.01f); break; // Load neutral position and start RC Roll,Pitch,Yaw control with stabilization case MAV_MOUNT_MODE_RC_TARGETING: // do nothing if pilot is controlling the roll, pitch and yaw break; // set lat, lon, alt position targets from mavlink message case MAV_MOUNT_MODE_GPS_POINT: Location target_location; memset(&target_location, 0, sizeof(target_location)); target_location.lat = packet.input_a; target_location.lng = packet.input_b; target_location.alt = packet.input_c; target_location.flags.relative_alt = true; set_roi_target(target_location); break; default: // do nothing break; } } // update_targets_from_rc - updates angle targets using input from receiver void AP_Mount_Backend::update_targets_from_rc() { #define rc_ch(i) RC_Channel::rc_channel(i-1) uint8_t roll_rc_in = _state._roll_rc_in; uint8_t tilt_rc_in = _state._tilt_rc_in; uint8_t pan_rc_in = _state._pan_rc_in; // if joystick_speed is defined then pilot input defines a rate of change of the angle if (_frontend._joystick_speed) { // allow pilot speed position input to come directly from an RC_Channel if (roll_rc_in && rc_ch(roll_rc_in)) { _angle_ef_target_rad.x += rc_ch(roll_rc_in)->norm_input_dz() * 0.0001f * _frontend._joystick_speed; constrain_float(_angle_ef_target_rad.x, radians(_state._roll_angle_min*0.01f), radians(_state._roll_angle_max*0.01f)); } if (tilt_rc_in && (rc_ch(tilt_rc_in))) { _angle_ef_target_rad.y += rc_ch(tilt_rc_in)->norm_input_dz() * 0.0001f * _frontend._joystick_speed; constrain_float(_angle_ef_target_rad.y, radians(_state._tilt_angle_min*0.01f), radians(_state._tilt_angle_max*0.01f)); } if (pan_rc_in && (rc_ch(pan_rc_in))) { _angle_ef_target_rad.z += rc_ch(pan_rc_in)->norm_input_dz() * 0.0001f * _frontend._joystick_speed; constrain_float(_angle_ef_target_rad.z, radians(_state._pan_angle_min*0.01f), radians(_state._pan_angle_max*0.01f)); } } else { // allow pilot position input to come directly from an RC_Channel if (roll_rc_in && (rc_ch(roll_rc_in))) { _angle_ef_target_rad.x = angle_input_rad(rc_ch(roll_rc_in), _state._roll_angle_min, _state._roll_angle_max); } if (tilt_rc_in && (rc_ch(tilt_rc_in))) { _angle_ef_target_rad.y = angle_input_rad(rc_ch(tilt_rc_in), _state._tilt_angle_min, _state._tilt_angle_max); } if (pan_rc_in && (rc_ch(pan_rc_in))) { _angle_ef_target_rad.z = angle_input_rad(rc_ch(pan_rc_in), _state._pan_angle_min, _state._pan_angle_max); } } } // returns the angle (degrees*100) that the RC_Channel input is receiving int32_t AP_Mount_Backend::angle_input(RC_Channel* rc, int16_t angle_min, int16_t angle_max) { return (rc->get_reverse() ? -1 : 1) * (rc->radio_in - rc->radio_min) * (int32_t)(angle_max - angle_min) / (rc->radio_max - rc->radio_min) + (rc->get_reverse() ? angle_max : angle_min); } // returns the angle (radians) that the RC_Channel input is receiving float AP_Mount_Backend::angle_input_rad(RC_Channel* rc, int16_t angle_min, int16_t angle_max) { return radians(angle_input(rc, angle_min, angle_max)*0.01f); } // calc_angle_to_location - calculates the earth-frame roll, tilt and pan angles (and radians) to point at the given target void AP_Mount_Backend::calc_angle_to_location(const struct Location &target, Vector3f& angles_to_target_rad, bool calc_tilt, bool calc_pan) { float GPS_vector_x = (target.lng-_frontend._current_loc.lng)*cosf(ToRad((_frontend._current_loc.lat+target.lat)*0.00000005f))*0.01113195f; float GPS_vector_y = (target.lat-_frontend._current_loc.lat)*0.01113195f; float GPS_vector_z = (target.alt-_frontend._current_loc.alt); // baro altitude(IN CM) should be adjusted to known home elevation before take off (Set altimeter). float target_distance = 100.0f*pythagorous2(GPS_vector_x, GPS_vector_y); // Careful , centimeters here locally. Baro/alt is in cm, lat/lon is in meters. // initialise all angles to zero angles_to_target_rad.zero(); // tilt calcs if (calc_tilt) { angles_to_target_rad.y = atan2f(GPS_vector_z, target_distance); } // pan calcs if (calc_pan) { // calc absolute heading and then onvert to vehicle relative yaw angles_to_target_rad.z = wrap_PI(atan2f(GPS_vector_x, GPS_vector_y) - _frontend._ahrs.yaw); } }
{ "content_hash": "07391d4ee7a2b92520c3781b71adadef", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 188, "avg_line_length": 43.83443708609271, "alnum_prop": 0.6455657954373772, "repo_name": "Yndal/ArduPilot-SensorPlatform", "id": "addff24c4ac5b0b569ffbd177f20f9aa9d533cfc", "size": "6728", "binary": false, "copies": "13", "ref": "refs/heads/master", "path": "ardupilot/libraries/AP_Mount/AP_Mount_Backend.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Arduino", "bytes": "12462" }, { "name": "Assembly", "bytes": "799628" }, { "name": "Batchfile", "bytes": "68199" }, { "name": "C", "bytes": "55034159" }, { "name": "C#", "bytes": "9917" }, { "name": "C++", "bytes": "13663242" }, { "name": "CMake", "bytes": "13681" }, { "name": "CSS", "bytes": "6280" }, { "name": "EmberScript", "bytes": "19928" }, { "name": "GDB", "bytes": "744" }, { "name": "Groff", "bytes": "43610" }, { "name": "HTML", "bytes": "9849" }, { "name": "Io", "bytes": "286" }, { "name": "Java", "bytes": "4394945" }, { "name": "Lex", "bytes": "13878" }, { "name": "Lua", "bytes": "87871" }, { "name": "M4", "bytes": "15467" }, { "name": "Makefile", "bytes": "8807880" }, { "name": "Matlab", "bytes": "185473" }, { "name": "Objective-C", "bytes": "24203" }, { "name": "OpenEdge ABL", "bytes": "12712" }, { "name": "PHP", "bytes": "484" }, { "name": "Pascal", "bytes": "253102" }, { "name": "Perl", "bytes": "17902" }, { "name": "Processing", "bytes": "168008" }, { "name": "Python", "bytes": "1785059" }, { "name": "Ruby", "bytes": "7108" }, { "name": "Scilab", "bytes": "1502" }, { "name": "Shell", "bytes": "1276765" }, { "name": "Yacc", "bytes": "30289" } ], "symlink_target": "" }
"use strict"; exports.__esModule = true; exports.serializeWindow = serializeWindow; exports.deserializeWindow = deserializeWindow; exports.ProxyWindow = void 0; var _src = require("cross-domain-utils/src"); var _src2 = require("zalgo-promise/src"); var _src3 = require("belter/src"); var _src4 = require("universal-serialize/src"); var _conf = require("../conf"); var _global = require("../global"); var _lib = require("../lib"); var _bridge = require("../bridge"); function cleanupProxyWindows() { const idToProxyWindow = (0, _global.globalStore)('idToProxyWindow'); for (const id of idToProxyWindow.keys()) { // $FlowFixMe if (idToProxyWindow.get(id).shouldClean()) { idToProxyWindow.del(id); } } } function getSerializedWindow(winPromise, { send, id = (0, _src3.uniqueID)() }) { let windowNamePromise = winPromise.then(win => { if ((0, _src.isSameDomain)(win)) { return (0, _src.assertSameDomain)(win).name; } }); return { id, getType: () => winPromise.then(win => { return (0, _src.getOpener)(win) ? _src.WINDOW_TYPE.POPUP : _src.WINDOW_TYPE.IFRAME; }), getInstanceID: (0, _src3.memoizePromise)(() => winPromise.then(win => (0, _lib.getWindowInstanceID)(win, { send }))), close: () => winPromise.then(_src.closeWindow), getName: () => winPromise.then(win => { if ((0, _src.isWindowClosed)(win)) { return; } if ((0, _src.isSameDomain)(win)) { return (0, _src.assertSameDomain)(win).name; } return windowNamePromise; }), focus: () => winPromise.then(win => { win.focus(); }), isClosed: () => winPromise.then(win => { return (0, _src.isWindowClosed)(win); }), setLocation: href => winPromise.then(win => { if ((0, _src.isSameDomain)(win)) { try { if (win.location && typeof win.location.replace === 'function') { // $FlowFixMe win.location.replace(href); return; } } catch (err) {// pass } } win.location = href; }), setName: name => winPromise.then(win => { if (__POST_ROBOT__.__IE_POPUP_SUPPORT__) { (0, _bridge.linkWindow)({ win, name }); } const sameDomain = (0, _src.isSameDomain)(win); const frame = (0, _src.getFrameForWindow)(win); if (!sameDomain) { throw new Error(`Can not set name for cross-domain window: ${name}`); } (0, _src.assertSameDomain)(win).name = name; if (frame) { frame.setAttribute('name', name); } windowNamePromise = _src2.ZalgoPromise.resolve(name); }) }; } class ProxyWindow { constructor({ send, win, serializedWindow }) { this.id = void 0; this.isProxyWindow = true; this.serializedWindow = void 0; this.actualWindow = void 0; this.actualWindowPromise = void 0; this.send = void 0; this.name = void 0; this.actualWindowPromise = new _src2.ZalgoPromise(); this.serializedWindow = serializedWindow || getSerializedWindow(this.actualWindowPromise, { send }); (0, _global.globalStore)('idToProxyWindow').set(this.getID(), this); if (win) { this.setWindow(win, { send }); } } getID() { return this.serializedWindow.id; } getType() { return this.serializedWindow.getType(); } isPopup() { return this.getType().then(type => { return type === _src.WINDOW_TYPE.POPUP; }); } setLocation(href) { return this.serializedWindow.setLocation(href).then(() => this); } getName() { return this.serializedWindow.getName(); } setName(name) { return this.serializedWindow.setName(name).then(() => this); } close() { return this.serializedWindow.close().then(() => this); } focus() { const isPopupPromise = this.isPopup(); const getNamePromise = this.getName(); const reopenPromise = _src2.ZalgoPromise.hash({ isPopup: isPopupPromise, name: getNamePromise }).then(({ isPopup, name }) => { if (isPopup && name) { window.open('', name); } }); const focusPromise = this.serializedWindow.focus(); return _src2.ZalgoPromise.all([reopenPromise, focusPromise]).then(() => this); } isClosed() { return this.serializedWindow.isClosed(); } getWindow() { return this.actualWindow; } setWindow(win, { send }) { this.actualWindow = win; this.actualWindowPromise.resolve(this.actualWindow); this.serializedWindow = getSerializedWindow(this.actualWindowPromise, { send, id: this.getID() }); (0, _global.windowStore)('winToProxyWindow').set(win, this); } awaitWindow() { return this.actualWindowPromise; } matchWindow(win, { send }) { return _src2.ZalgoPromise.try(() => { if (this.actualWindow) { return win === this.actualWindow; } return _src2.ZalgoPromise.hash({ proxyInstanceID: this.getInstanceID(), knownWindowInstanceID: (0, _lib.getWindowInstanceID)(win, { send }) }).then(({ proxyInstanceID, knownWindowInstanceID }) => { const match = proxyInstanceID === knownWindowInstanceID; if (match) { this.setWindow(win, { send }); } return match; }); }); } unwrap() { return this.actualWindow || this; } getInstanceID() { return this.serializedWindow.getInstanceID(); } shouldClean() { return Boolean(this.actualWindow && (0, _src.isWindowClosed)(this.actualWindow)); } serialize() { return this.serializedWindow; } static unwrap(win) { return ProxyWindow.isProxyWindow(win) // $FlowFixMe ? win.unwrap() : win; } static serialize(win, { send }) { cleanupProxyWindows(); return ProxyWindow.toProxyWindow(win, { send }).serialize(); } static deserialize(serializedWindow, { send }) { cleanupProxyWindows(); return (0, _global.globalStore)('idToProxyWindow').get(serializedWindow.id) || new ProxyWindow({ serializedWindow, send }); } static isProxyWindow(obj) { // $FlowFixMe return Boolean(obj && !(0, _src.isWindow)(obj) && obj.isProxyWindow); } static toProxyWindow(win, { send }) { cleanupProxyWindows(); if (ProxyWindow.isProxyWindow(win)) { // $FlowFixMe return win; } // $FlowFixMe const actualWindow = win; return (0, _global.windowStore)('winToProxyWindow').get(actualWindow) || new ProxyWindow({ win: actualWindow, send }); } } exports.ProxyWindow = ProxyWindow; function serializeWindow(destination, domain, win, { send }) { return (0, _src4.serializeType)(_conf.SERIALIZATION_TYPE.CROSS_DOMAIN_WINDOW, ProxyWindow.serialize(win, { send })); } function deserializeWindow(source, origin, win, { send }) { return ProxyWindow.deserialize(win, { send }); }
{ "content_hash": "f5f91a4e54ccc6310750d58adf38ef8b", "timestamp": "", "source": "github", "line_count": 321, "max_line_length": 110, "avg_line_length": 22.077881619937695, "alnum_prop": 0.5933399181600113, "repo_name": "cdnjs/cdnjs", "id": "d025dc55889c1ac07565edfd10b19eb642cde0a5", "size": "7087", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "ajax/libs/post-robot/10.0.29/module/serialize/window.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?php namespace Crummy\Phlack\Common\Matcher; use Crummy\Phlack\WebHook\CommandInterface; class NonMatcher implements MatcherInterface { /** * @param CommandInterface $command * * @return bool */ public function matches(CommandInterface $command) { return false; } }
{ "content_hash": "6ae281771a7e6befd6c791df46973eeb", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 54, "avg_line_length": 17.444444444444443, "alnum_prop": 0.6656050955414012, "repo_name": "mcrumm/phlack", "id": "aa1e68643e7a6f051521c641d3d46fd961df06ae", "size": "314", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/Common/Matcher/NonMatcher.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "123031" } ], "symlink_target": "" }
package org.tuxdevelop.spring.batch.lightmin.server.scheduler.repository.configuration; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @Data @ConfigurationProperties(prefix = "spring.batch.lightmin.server.scheduler.repository.jdbc") public class ServerSchedulerJdbcConfigurationProperties { private String configurationTable = "SCHEDULER_CONFIGURATION"; private String configurationValueTable = "SCHEDULER_CONFIGURATION_VALUE"; private String executionTable = "SCHEDULER_EXECUTION"; private String databaseSchema; private String datasourceName = "dataSource"; }
{ "content_hash": "898c009c50cc424404127cff6033bd0b", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 91, "avg_line_length": 39.6875, "alnum_prop": 0.8188976377952756, "repo_name": "tuxdevelop/spring-batch-lightmin", "id": "e43703eca4ea5811c9d766d3d91961e94aa9cbfe", "size": "635", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spring-batch-lightmin-server/spring-batch-lightmin-server-scheduler/spring-batch-lightmin-server-scheduler-repository/spring-batch-lightmin-server-scheduler-repository-jdbc/src/main/java/org/tuxdevelop/spring/batch/lightmin/server/scheduler/repository/configuration/ServerSchedulerJdbcConfigurationProperties.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3202" }, { "name": "HTML", "bytes": "250812" }, { "name": "Java", "bytes": "1080040" }, { "name": "TSQL", "bytes": "4738" } ], "symlink_target": "" }
body { margin: 0; padding: 0; } #header { text-align: center; background-image: url("../resources/bgTile.jpg"); background-repeat: repeat; } #header>h1 { color: whitesmoke; font-size: 40px; font-family: Georgia, 'Times New Roman', Times, serif; } h1>span { font-size: 48px; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: bold; } #footer { text-align: center; } #copyright { font-size: 14px; font-family: Georgia, 'Times New Roman', Times, serif; } #sidebar { float: right; } #content { height: 800px; margin: 0 auto; } #home { width: 80%; height: auto; position: relative; box-shadow: 10px 10px 5px #888888; background-image: url("../resources/bgTile.jpg"); background-repeat: repeat; } .centerDiv { margin: 10% auto; } #contentText { color: white; font-size: 24px; font-family: Georgia, 'Times New Roman', Times, serif; text-align: center; } .buttonpanel { margin: 0 auto; width: 80%; text-align:center; padding: 20px; } .textalignright { text-align: right; }
{ "content_hash": "15ef13f8b692a3ec3202a0ce0a211f53", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 58, "avg_line_length": 15.873239436619718, "alnum_prop": 0.6086956521739131, "repo_name": "inmank/prince_housing_ang", "id": "35731736446ea9fcd8e6650f2c1774f867d36003", "size": "1127", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/resources/styles.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1127" }, { "name": "HTML", "bytes": "5840" }, { "name": "JavaScript", "bytes": "1487" } ], "symlink_target": "" }
require 'mspec/runner/formatters/base' class HtmlFormatter < BaseFormatter def register super MSpec.register :start, self MSpec.register :enter, self MSpec.register :leave, self end def start print <<-EOH <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Spec Output For #{RUBY_ENGINE} (#{RUBY_VERSION})</title> <style type="text/css"> ul { list-style: none; } .fail { color: red; } .pass { color: green; } #details :target { background-color: #ffffe0; } </style> </head> <body> EOH end def enter(describe) print "<div><p>#{describe}</p>\n<ul>\n" end def leave print "</ul>\n</div>\n" end def exception(exception) super(exception) outcome = exception.failure? ? "FAILED" : "ERROR" print %[<li class="fail">- #{exception.it} (<a href="#details-#{@count}">] print %[#{outcome} - #{@count}</a>)</li>\n] end def after(state = nil) super(state) print %[<li class="pass">- #{state.it}</li>\n] unless exception? end def finish success = @exceptions.empty? unless success print "<hr>\n" print %[<ol id="details">] count = 0 @exceptions.each do |exc| outcome = exc.failure? ? "FAILED" : "ERROR" print %[\n<li id="details-#{count += 1}"><p>#{escape(exc.description)} #{outcome}</p>\n<p>] print escape(exc.message) print "</p>\n<pre>\n" print escape(exc.backtrace) print "</pre>\n</li>\n" end print "</ol>\n" end print %[<p>#{@timer.format}</p>\n] print %[<p class="#{success ? "pass" : "fail"}">#{@tally.format}</p>\n] print "</body>\n</html>\n" end def escape(string) string.gsub("&", "&nbsp;").gsub("<", "&lt;").gsub(">", "&gt;") end end
{ "content_hash": "d724299ef9bbc8f4e0ff3b00eaa48b4f", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 99, "avg_line_length": 22.320987654320987, "alnum_prop": 0.5730088495575221, "repo_name": "ruby/mspec", "id": "e37e89a088cf5c98cfe061a0e8a01e69b425b9e8", "size": "1808", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "lib/mspec/runner/formatters/html.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "120" }, { "name": "Ruby", "bytes": "605484" }, { "name": "Shell", "bytes": "643" } ], "symlink_target": "" }
package edu.umich.lib.infinispan; import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.infinispan.manager.EmbeddedCacheManager; import org.infinispan.server.hotrod.HotRodServer; import org.infinispan.server.hotrod.configuration.HotRodServerConfiguration; import org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder; public class HotRodListener extends Listener { private final static String CONFIGURATION = "edu.umich.lib.infinispan.HotRodListener.CONFIGURATION"; private final static String SERVER = "edu.umich.lib.infinispan.HotRodListener.SERVER"; private final static String HOTROD_HOST = "infinispan.hotrod.host"; private final static String HOTROD_PORT = "infinispan.hotrod.port"; public static HotRodServerConfiguration getConfiguration(ServletContext ctx) { return (HotRodServerConfiguration) ctx.getAttribute(CONFIGURATION); } private static void setServer(ServletContext ctx, HotRodServer server) { ctx.setAttribute(SERVER, server); } private static HotRodServer getServer(ServletContext ctx) { return (HotRodServer) ctx.getAttribute(SERVER); } public static void setConfiguration(ServletContext ctx, HotRodServerConfiguration cfg) { ctx.setAttribute(CONFIGURATION, cfg); } public HotRodServerConfiguration createConfiguration (ServletContext ctx) { HotRodServerConfigurationBuilder builder = new HotRodServerConfigurationBuilder(); String port = getParameter(ctx, HOTROD_PORT); if (port != null) { builder.port(Integer.parseInt(port)); } String host = getParameter(ctx, HOTROD_HOST); if (host != null) { builder.host(host); } HotRodServerConfiguration config = builder.build(); setConfiguration(ctx, config); return config; } private HotRodServer createServer(ServletContext ctx) { HotRodServer server = new HotRodServer(); setServer(ctx, server); return server; } @Override public void contextInitialized(ServletContextEvent sce) { synchronized (sce) { ServletContext ctx = sce.getServletContext(); HotRodServer server = getServer(ctx); if (server == null) { server = createServer(ctx); } EmbeddedCacheManager cm = getCacheManager(ctx); if (cm == null) { cm = createCacheManager(ctx); } HotRodServerConfiguration config = getConfiguration(ctx); if (config == null) { config = createConfiguration(ctx); } server.start(config, cm); } } @Override public void contextDestroyed(ServletContextEvent sce) { synchronized (sce) { HotRodServer server = getServer(sce.getServletContext()); if (server != null) { server.stop(); } super.contextDestroyed(sce); } } }
{ "content_hash": "e5d5eb2b10eada1f0e1b743e6fd8f6eb", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 103, "avg_line_length": 32.93478260869565, "alnum_prop": 0.692079207920792, "repo_name": "bertrama/infinispan-war", "id": "10d75a3d732208d38abceb0579fc16a59fb95710", "size": "3030", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/main/java/edu/umich/lib/infinispan/HotRodListener.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "3431" }, { "name": "Java", "bytes": "17007" }, { "name": "Shell", "bytes": "1982" } ], "symlink_target": "" }
layout: post title: "Who does chores" description: "" date: 2021-05-30 author: "Yawei" categories: "English" keywords: - English - Communicating --- # Some sentences In my home both my husband and myself do the chores. I hire people to the painting. She had the windows washed yesterday. // This means she hired someone to wash the window I washed the windows yesterday. // This means I washed the window myself.
{ "content_hash": "3f3630429ce9818e850808053820467f", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 88, "avg_line_length": 20.523809523809526, "alnum_prop": 0.7238979118329466, "repo_name": "pfcstyle/pfcstyle.github.io", "id": "8038cdfd88bab2fa2623a2297639252db9515c03", "size": "435", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2021-05-30-who-does-chores.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "20434" }, { "name": "HTML", "bytes": "42916" }, { "name": "JavaScript", "bytes": "9019" }, { "name": "Ruby", "bytes": "200" } ], "symlink_target": "" }
<?php /** * Created by PhpStorm. * User: zsgy * Date: 2017/8/14 * Time: 15:04 */ namespace App\Repositories; use App\Models\Answer; /** * Class AnswerRepository * @package App\Repositories */ class AnswerRepository { public function create(array $attribute) { return Answer::create($attribute); } public function byId($id) { return Answer::find($id); } public function getAnswerCommentsById($id) { $answer = Answer::with('comments', 'comments.user')->where('id', $id)->first(); return $answer->comments; } }
{ "content_hash": "804d56e5dff2ff25870db48fab2d013f", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 87, "avg_line_length": 16.82857142857143, "alnum_prop": 0.6095076400679117, "repo_name": "hmx224/blog_ifanatic.cn", "id": "026095b4e331a5ad807f59af55decb44799ea6f6", "size": "589", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/Repositories/AnswerRepository.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "3055" }, { "name": "C#", "bytes": "16030" }, { "name": "HTML", "bytes": "1368777" }, { "name": "Java", "bytes": "38326" }, { "name": "PHP", "bytes": "696197" }, { "name": "Vue", "bytes": "37706" } ], "symlink_target": "" }
from flask import Flask, jsonify, render_template, request import json import unicodedata from brain import best_move import os app = Flask(__name__) def helper(arr): return map(lambda x : unicodedata.normalize('NFKD', x).encode('ascii','ignore'), arr) def transform(arr): return map(lambda x : 1 if x == 'X' else (None if len(x) == 0 else 0), arr) def convert(tup): return str((tup[0] * 3) + 1 + tup[1]) @app.route('/') def index(): return render_template('index.html') @app.route('/process', methods = ["POST"]) def process(): data = json.loads(request.form.keys()[0])['x'] data = map(helper , data) data = map(transform, data) ans = convert(best_move(data)) return ans
{ "content_hash": "c90c7dbcfd0d1193518b2620c0feaabf", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 89, "avg_line_length": 23.9, "alnum_prop": 0.6429567642956764, "repo_name": "adijo/min-max-tic-tac-toe", "id": "9f3017c877a1c15d09448391ec23f9c117af6bb3", "size": "717", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "695" }, { "name": "HTML", "bytes": "1371" }, { "name": "JavaScript", "bytes": "3937" }, { "name": "Python", "bytes": "3199" } ], "symlink_target": "" }
import React from 'react'; import Viewport from './components/Viewport'; export default function withViewport(nameOrOptions) { const options = typeof nameOrOptions === 'string' ? { name: nameOrOptions } : nameOrOptions; const decorator = getStory => context => ( <Viewport context={context} {...options}> {getStory()} </Viewport> ); return (getStory, context) => { if (typeof context === 'undefined') { return decorator(getStory); } return decorator(getStory)(context); }; }
{ "content_hash": "fb06cac9a888bf85c0da04d6e62d0b90", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 94, "avg_line_length": 26.05, "alnum_prop": 0.654510556621881, "repo_name": "rhalff/storybook", "id": "cfe11ab7622e75a4a012f20e563fa68bb55c5a7b", "size": "521", "binary": false, "copies": "1", "ref": "refs/heads/addon-actions", "path": "addons/viewport/src/preview/withViewport.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2668" }, { "name": "HTML", "bytes": "19272" }, { "name": "Java", "bytes": "2658" }, { "name": "JavaScript", "bytes": "740774" }, { "name": "Objective-C", "bytes": "8846" }, { "name": "Python", "bytes": "3468" }, { "name": "Shell", "bytes": "7425" }, { "name": "TypeScript", "bytes": "30458" }, { "name": "Vue", "bytes": "13203" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <title>CSS Test (Transforms): Transform of Background Image (propagated body with root element transform)</title> <link rel="author" title="Aryeh Gregor" href="mailto:ayg@aryeh.name"> <link rel="help" href="http://www.w3.org/TR/css-transforms-1/#transform-rendering"> <link rel="reviewer" title="Apple Inc." href="http://www.apple.com"> <meta name="assert" content='"If the root element is transformed, the transformation should not apply to any background specified for the root element.'> <meta name="flags" content="svg"> <link rel="match" href="transform-root-bg-001-ref.html"> <style> html { overflow: hidden; transform: rotate(90deg); transform-origin: 50px 50px; } body { background: url(support/transform-triangle-left.svg); } </style> </head> <body> </body> </html>
{ "content_hash": "356c968e82a09cfd1adda9cd2d6327ae", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 117, "avg_line_length": 36.36, "alnum_prop": 0.6490649064906491, "repo_name": "chromium/chromium", "id": "787c593fb093a74f5c0bbc07a511acae37ec929b", "size": "909", "binary": false, "copies": "14", "ref": "refs/heads/main", "path": "third_party/blink/web_tests/external/wpt/css/css-transforms/transform-background-007.html", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
#region Copyright & license notice #endregion using System; using Amazon.WebServices.MechanicalTurk.Domain; namespace Amazon.WebServices.MechanicalTurk.Exceptions { /// <summary> /// Description of AccessKeyException. /// </summary> public class AccessKeyException : ServiceException { /// <summary> /// Initializes a new instance of the <see cref="AccessKeyException"/> class. /// </summary> /// <param name="serviceError">The service error.</param> /// <param name="serviceResponse">The service response.</param> public AccessKeyException(ErrorsError serviceError, object serviceResponse) : base(serviceError, serviceResponse) { } } }
{ "content_hash": "7262e6c79b2f1a4ac932c5d62750ab8e", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 85, "avg_line_length": 27.53846153846154, "alnum_prop": 0.6829608938547486, "repo_name": "DeSciL/DotnetMturk", "id": "56ea77091298c0440d4635d57cb13169dc7118b6", "size": "823", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Amazon.WebServices.MechanicalTurk/Exceptions/AccessKeyException.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "1038662" }, { "name": "PowerShell", "bytes": "1958" } ], "symlink_target": "" }
/// Copyright (c) 2012 Ecma International. All rights reserved. /// Ecma International makes this code available under the terms and conditions set /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright and this notice and otherwise comply with the Use Terms. /** * @path ch15/15.2/15.2.3/15.2.3.5/15.2.3.5-4-129.js * @description Object.create - 'configurable' property of one property in 'Properties' is 0 (8.10.5 step 4.b) */ function testcase() { var newObj = Object.create({}, { prop: { configurable: 0 } }); var beforeDeleted = newObj.hasOwnProperty("prop"); delete newObj.prop; var afterDeleted = newObj.hasOwnProperty("prop"); return beforeDeleted === true && afterDeleted === true; } runTestCase(testcase);
{ "content_hash": "1c606dd8bdf2ecac035c76dc79dd01b8", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 110, "avg_line_length": 34.32142857142857, "alnum_prop": 0.6253902185223725, "repo_name": "popravich/typescript", "id": "aae9f820ffd1b7145c8d88650f5932d6a32dd164", "size": "961", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "tests/Fidelity/test262/suite/ch15/15.2/15.2.3/15.2.3.5/15.2.3.5-4-129.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Elixir", "bytes": "3294" }, { "name": "JavaScript", "bytes": "24683236" }, { "name": "Shell", "bytes": "386" }, { "name": "TypeScript", "bytes": "21471232" } ], "symlink_target": "" }
require 'ffi' require 'health-data-standards' require 'os' module GoCDATools module Import class GoImporter include Singleton extend FFI::Library if OS.linux? ffi_lib File.expand_path("../../../ext/libgocda-linux.so", File.dirname(__FILE__)) end if OS.mac? ffi_lib File.expand_path("../../../ext/libgocda-mac.so", File.dirname(__FILE__)) end attach_function :import_cat1, [:string], :string def parse_with_ffi(file) data = file.kind_of?(String) ? file : file.to_xml patient_json_string = import_cat1(data) if patient_json_string.start_with?("Import Failed") raise patient_json_string end patient = Record.new(JSON.parse(patient_json_string)) # FIXME: This is here because QME has a bug where patients don't calculate accurately if birthdate is exactly 0 (01/01/1970) # The plan is to remove this once Cypress integrates CQL and no longer relies on QME for calculation patient.birthdate += 1 if patient.birthdate == 0 # When imported from go, conditions that are unresolved need to have a stop_time added update_conditions(patient) # When imported from go, entry ids need to be updated to reflected references update_entry_references(patient, resolve_references(patient)) patient.dedup_record! patient end def update_conditions(record) record.conditions.each do |condition| if condition.status_code['HL7 ActStatus'] && condition.status_code['HL7 ActStatus'][0] == '' condition.status_code['HL7 ActStatus'][0] = nil end condition[:end_time] = nil if condition[:end_time].nil? end end def resolve_references(record) # A hash that contains original referenceId ("exported_ref") and mapping to a generated id refs = {} record.entries.each do |entry| entry.references.each do |ref| # If an original referenceId has already been mapped to a generated id, don't create a new id refs[ref.exported_ref] = BSON::ObjectId.new unless refs.include?(ref.exported_ref) # Set the referenceId to the id that has been generated ref.referenced_id = refs[ref.exported_ref] end end refs end def update_entry_references(record, refs) record.entries.each do |entry| # If an entry is referenced, the id needs to be updated to match the id that was generated for the reference if refs.include?(entry.cda_identifier.extension) entry._id = refs[entry.cda_identifier.extension] # Since the original cda_identifier is no longer relevant, remove entry.cda_identifier = nil else # If an entry is not referenced, use the cda_identifier as the id entry._id = entry.cda_identifier._id end end end end end end
{ "content_hash": "c6428d69a060b2a42fc48c900beb467b", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 134, "avg_line_length": 40.79220779220779, "alnum_prop": 0.6033110474371219, "repo_name": "projectcypress/go-cda-tools", "id": "e3bb0c99646567628ae87e6aa3ec4f90dbe51869", "size": "3141", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/go-cda-tools/import/go-importer.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "3134" }, { "name": "Go", "bytes": "1377" }, { "name": "Makefile", "bytes": "377" }, { "name": "Ruby", "bytes": "33052" } ], "symlink_target": "" }
FROM balenalib/generic-ubuntu:bionic-build # remove several traces of debian python RUN apt-get purge -y python.* # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 # key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported # key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \ && gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \ && gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059 ENV PYTHON_VERSION 3.9.1 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" ENV PYTHON_PIP_VERSION 20.3.1 ENV SETUPTOOLS_VERSION 51.0.0 RUN set -x \ && curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" \ && echo "0eade61b25e2eaeec4ce48426bc4c9f0139c73621d4d904d6ab740565f066062 Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" | sha256sum -c - \ && tar -xzf "Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" --strip-components=1 \ && rm -rf "Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" \ && ldconfig \ && if [ ! -e /usr/local/bin/pip3 ]; then : \ && curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \ && echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \ && python3 get-pip.py \ && rm get-pip.py \ ; fi \ && pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \ && find /usr/local \ \( -type d -a -name test -o -name tests \) \ -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ -exec rm -rf '{}' + \ && cd / \ && rm -rf /usr/src/python ~/.cache # install "virtualenv", since the vast majority of users of this image will want it RUN pip3 install --no-cache-dir virtualenv ENV PYTHON_DBUS_VERSION 1.2.8 # install dbus-python dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ libdbus-1-dev \ libdbus-glib-1-dev \ && rm -rf /var/lib/apt/lists/* \ && apt-get -y autoremove # install dbus-python RUN set -x \ && mkdir -p /usr/src/dbus-python \ && curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \ && curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \ && gpg --verify dbus-python.tar.gz.asc \ && tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \ && rm dbus-python.tar.gz* \ && cd /usr/src/dbus-python \ && PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \ && make -j$(nproc) \ && make install -j$(nproc) \ && cd / \ && rm -rf /usr/src/dbus-python # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ && ln -sf pip3 pip \ && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -sf idle3 idle \ && ln -sf pydoc3 pydoc \ && ln -sf python3 python \ && ln -sf python3-config python-config # set PYTHONPATH to point to dist-packages ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \ && echo "Running test-stack@python" \ && chmod +x test-stack@python.sh \ && bash test-stack@python.sh \ && rm -rf test-stack@python.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Ubuntu bionic \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.9.1, Pip v20.3.1, Setuptools v51.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "80137fed8cbcd73cedaf53318d2b92d7", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 725, "avg_line_length": 50.67368421052632, "alnum_prop": 0.7033651848774408, "repo_name": "nghiant2710/base-images", "id": "8ec9e4c32706dc070a73267b4eb6f17f33ced3ec", "size": "4835", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/python/generic/ubuntu/bionic/3.9.1/build/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/slave/rel-2.0-xr-osx64-bld/build/profile/public/nsIProfileChangeStatus.idl */ #ifndef __gen_nsIProfileChangeStatus_h__ #define __gen_nsIProfileChangeStatus_h__ #ifndef __gen_nsISupports_h__ #include "nsISupports.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif /** * nsIObserver topics for profile changing. Profile changing happens in phases * in the order given below. An observer may register separately for each phase * of the process depending on its needs. The subject passed to the observer's * Observe() method can be QI'd to an nsIProfileChangeStatus. * * "profile-approve-change" * Called before a profile change is attempted. Typically, * the application level observer will ask the user if * he/she wants to stop all network activity, close all open * windows, etc. If the user says NO, the observer should * call the subject's vetoChange(). If any observer does * this, the profile will not be changed. * * "profile-change-teardown" * All async activity must be stopped in this phase. Typically, * the application level observer will close all open windows. * This is the last phase in which the subject's vetoChange() * method may still be called. * The next notification will be either * profile-change-teardown-veto or profile-before-change. * * "profile-change-teardown-veto" * This notification will only be sent, if the profile change * was vetoed during the profile-change-teardown phase. * This allows components to bring back required resources, * that were tore down on profile-change-teardown. * * "profile-before-change" * Called before the profile has changed. Use this notification * to prepare for the profile going away. If a component is * holding any state which needs to be flushed to a profile-relative * location, it should be done here. * * "profile-do-change" * Called after the profile has changed. Do the work to * respond to having a new profile. Any change which * affects others must be done in this phase. * * "profile-after-change" * Called after the profile has changed. Use this notification * to make changes that are dependent on what some other listener * did during its profile-do-change. For example, to respond to * new preferences. * * "profile-initial-state" * Called after all phases of a change have completed. Typically * in this phase, an application level observer will open a new window. * * Contexts for profile changes. These are passed as the someData param to the * observer's Observe() method. * "startup" * Going from no profile to a profile. * * The following topics happen in this context: * profile-do-change * profile-after-change * * "shutdown-persist" * The user is logging out and whatever data the observer stores * for the current profile should be released from memory and * saved to disk. * * "shutdown-cleanse" * The user is logging out and whatever data the observer stores * for the current profile should be released from memory and * deleted from disk. * * The following topics happen in both shutdown contexts: * profile-approve-change * profile-change-teardown * profile-before-change * * "switch" * Going from one profile to another. * * All of the above topics happen in a profile switch. * */ /* starting interface: nsIProfileChangeStatus */ #define NS_IPROFILECHANGESTATUS_IID_STR "2f977d43-5485-11d4-87e2-0010a4e75ef2" #define NS_IPROFILECHANGESTATUS_IID \ {0x2f977d43, 0x5485, 0x11d4, \ { 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 }} class NS_NO_VTABLE NS_SCRIPTABLE nsIProfileChangeStatus : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPROFILECHANGESTATUS_IID) /* void vetoChange (); */ NS_SCRIPTABLE NS_IMETHOD VetoChange(void) = 0; /** * Called by a profile change observer when a fatal error * occurred during the attempt to switch the profile. * * The profile should be considered in an unsafe condition, * and the profile manager should inform the user and * exit immediately. * */ /* void changeFailed (); */ NS_SCRIPTABLE NS_IMETHOD ChangeFailed(void) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIProfileChangeStatus, NS_IPROFILECHANGESTATUS_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSIPROFILECHANGESTATUS \ NS_SCRIPTABLE NS_IMETHOD VetoChange(void); \ NS_SCRIPTABLE NS_IMETHOD ChangeFailed(void); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSIPROFILECHANGESTATUS(_to) \ NS_SCRIPTABLE NS_IMETHOD VetoChange(void) { return _to VetoChange(); } \ NS_SCRIPTABLE NS_IMETHOD ChangeFailed(void) { return _to ChangeFailed(); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSIPROFILECHANGESTATUS(_to) \ NS_SCRIPTABLE NS_IMETHOD VetoChange(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->VetoChange(); } \ NS_SCRIPTABLE NS_IMETHOD ChangeFailed(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->ChangeFailed(); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsProfileChangeStatus : public nsIProfileChangeStatus { public: NS_DECL_ISUPPORTS NS_DECL_NSIPROFILECHANGESTATUS nsProfileChangeStatus(); private: ~nsProfileChangeStatus(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsProfileChangeStatus, nsIProfileChangeStatus) nsProfileChangeStatus::nsProfileChangeStatus() { /* member initializers and constructor code */ } nsProfileChangeStatus::~nsProfileChangeStatus() { /* destructor code */ } /* void vetoChange (); */ NS_IMETHODIMP nsProfileChangeStatus::VetoChange() { return NS_ERROR_NOT_IMPLEMENTED; } /* void changeFailed (); */ NS_IMETHODIMP nsProfileChangeStatus::ChangeFailed() { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsIProfileChangeStatus_h__ */
{ "content_hash": "766bf9cdaea4388e1d10aea3c81933db", "timestamp": "", "source": "github", "line_count": 192, "max_line_length": 127, "avg_line_length": 34.197916666666664, "alnum_prop": 0.6995126408772464, "repo_name": "akiellor/selenium", "id": "467d3b49af795c7315d59205a25047a93b8a228e", "size": "6566", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "third_party/gecko-2/mac/include/nsIProfileChangeStatus.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "22777" }, { "name": "C", "bytes": "13787069" }, { "name": "C#", "bytes": "1592944" }, { "name": "C++", "bytes": "39839762" }, { "name": "Java", "bytes": "5948691" }, { "name": "JavaScript", "bytes": "15038006" }, { "name": "Objective-C", "bytes": "331601" }, { "name": "Python", "bytes": "544265" }, { "name": "Ruby", "bytes": "557579" }, { "name": "Shell", "bytes": "21701" } ], "symlink_target": "" }
package org.apache.camel.component.azure.blob; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import com.microsoft.azure.storage.AccessCondition; import com.microsoft.azure.storage.StorageException; import com.microsoft.azure.storage.blob.BlobListingDetails; import com.microsoft.azure.storage.blob.BlockEntry; import com.microsoft.azure.storage.blob.BlockListingFilter; import com.microsoft.azure.storage.blob.CloudAppendBlob; import com.microsoft.azure.storage.blob.CloudBlob; import com.microsoft.azure.storage.blob.CloudBlobContainer; import com.microsoft.azure.storage.blob.CloudBlockBlob; import com.microsoft.azure.storage.blob.CloudPageBlob; import com.microsoft.azure.storage.blob.ListBlobItem; import com.microsoft.azure.storage.blob.PageRange; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.WrappedFile; import org.apache.camel.component.azure.common.ExchangeUtil; import org.apache.camel.support.DefaultProducer; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.URISupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.apache.camel.component.azure.blob.BlobServiceUtil.getBlobName; /** * A Producer which sends messages to the Azure Storage Blob Service */ public class BlobServiceProducer extends DefaultProducer { private static final Logger LOG = LoggerFactory.getLogger(BlobServiceProducer.class); public BlobServiceProducer(final Endpoint endpoint) { super(endpoint); } @Override public void process(final Exchange exchange) throws Exception { BlobServiceOperations operation = determineOperation(exchange); if (ObjectHelper.isEmpty(operation)) { operation = BlobServiceOperations.listBlobs; } switch (operation) { case getBlob: getBlob(exchange); break; case deleteBlob: deleteBlob(exchange); break; case listBlobs: listBlobs(exchange); break; case updateBlockBlob: updateBlockBlob(exchange); break; case uploadBlobBlocks: uploadBlobBlocks(exchange); break; case commitBlobBlockList: commitBlobBlockList(exchange); break; case getBlobBlockList: getBlobBlockList(exchange); break; case createAppendBlob: createAppendBlob(exchange); break; case updateAppendBlob: updateAppendBlob(exchange); break; case createPageBlob: createPageBlob(exchange); break; case updatePageBlob: uploadPageBlob(exchange); break; case resizePageBlob: resizePageBlob(exchange); break; case clearPageBlob: clearPageBlob(exchange); break; case getPageBlobRanges: getPageBlobRanges(exchange); break; default: throw new IllegalArgumentException("Unsupported operation"); } } private void listBlobs(Exchange exchange) throws Exception { CloudBlobContainer client = BlobServiceUtil.createBlobContainerClient(exchange, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); LOG.trace("Getting the blob list from the container [{}] from exchange [{}]...", getConfiguration().getContainerName(), exchange); BlobServiceConfiguration cfg = getConfiguration(); EnumSet<BlobListingDetails> details = null; Object detailsObject = exchange.getIn().getHeader(BlobServiceConstants.BLOB_LISTING_DETAILS); if (detailsObject instanceof EnumSet) { @SuppressWarnings("unchecked") EnumSet<BlobListingDetails> theDetails = (EnumSet<BlobListingDetails>) detailsObject; details = theDetails; } else if (detailsObject instanceof BlobListingDetails) { details = EnumSet.of((BlobListingDetails) detailsObject); } Iterable<ListBlobItem> items = client.listBlobs(cfg.getBlobPrefix(), cfg.isUseFlatListing(), details, opts.getRequestOpts(), opts.getOpContext()); ExchangeUtil.getMessageForResponse(exchange).setBody(items); } private void updateBlockBlob(Exchange exchange) throws Exception { CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration()); configureCloudBlobForWrite(client); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); InputStream inputStream = getInputStreamFromExchange(exchange); if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Putting a block blob [{}] from exchange [{}]...", blobName, exchange); } try { client.upload(inputStream, -1, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } finally { closeInputStreamIfNeeded(inputStream); } } private void uploadBlobBlocks(Exchange exchange) throws Exception { Object object = exchange.getIn().getMandatoryBody(); List<BlobBlock> blobBlocks = null; if (object instanceof List) { blobBlocks = (List<BlobBlock>) object; } else if (object instanceof BlobBlock) { blobBlocks = Collections.singletonList((BlobBlock) object); } if (blobBlocks == null || blobBlocks.isEmpty()) { throw new IllegalArgumentException("Illegal storageBlocks payload"); } CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration()); configureCloudBlobForWrite(client); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Putting a blob [{}] from blocks from exchange [{}]...", blobName, exchange); } List<BlockEntry> blockEntries = new LinkedList<>(); for (BlobBlock blobBlock : blobBlocks) { blockEntries.add(blobBlock.getBlockEntry()); client.uploadBlock(blobBlock.getBlockEntry().getId(), blobBlock.getBlockStream(), -1, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } Boolean commitBlockListLater = exchange.getIn().getHeader(BlobServiceConstants.COMMIT_BLOCK_LIST_LATER, Boolean.class); if (Boolean.TRUE != commitBlockListLater) { client.commitBlockList(blockEntries, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } } private void commitBlobBlockList(Exchange exchange) throws Exception { Object object = exchange.getIn().getMandatoryBody(); List<BlockEntry> blockEntries = null; if (object instanceof List) { blockEntries = (List<BlockEntry>) object; } else if (object instanceof BlockEntry) { blockEntries = Collections.singletonList((BlockEntry) object); } if (blockEntries == null || blockEntries.isEmpty()) { throw new IllegalArgumentException("Illegal commit block list payload"); } CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Putting a blob [{}] block list from exchange [{}]...", blobName, exchange); } client.commitBlockList(blockEntries, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } private void getBlob(Exchange exchange) throws Exception { BlobServiceUtil.getBlob(exchange, getConfiguration()); } private void deleteBlob(Exchange exchange) throws Exception { switch (getConfiguration().getBlobType()) { case blockblob: deleteBlockBlob(exchange); break; case appendblob: deleteAppendBlob(exchange); break; case pageblob: deletePageBlob(exchange); break; default: throw new IllegalArgumentException("Unsupported blob type"); } } private void getBlobBlockList(Exchange exchange) throws Exception { CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Getting the blob block list [{}] from exchange [{}]...", blobName, exchange); } BlockListingFilter filter = exchange.getIn().getBody(BlockListingFilter.class); if (filter == null) { filter = BlockListingFilter.COMMITTED; } List<BlockEntry> blockEntries = client.downloadBlockList(filter, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); ExchangeUtil.getMessageForResponse(exchange).setBody(blockEntries); } private void deleteBlockBlob(Exchange exchange) throws Exception { CloudBlockBlob client = BlobServiceUtil.createBlockBlobClient(exchange, getConfiguration()); doDeleteBlock(client, exchange); } private void createAppendBlob(Exchange exchange) throws Exception { CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(exchange, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (opts.getAccessCond() == null) { // Default: do not reset the blob content if the blob already exists opts.setAccessCond(AccessCondition.generateIfNotExistsCondition()); } doCreateAppendBlob(client, opts, exchange); } private void doCreateAppendBlob(CloudAppendBlob client, BlobServiceRequestOptions opts, Exchange exchange) throws Exception { if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Creating an append blob [{}] from exchange [{}]...", blobName, exchange); } try { client.createOrReplace(opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } catch (StorageException ex) { if (ex.getHttpStatusCode() != 409) { throw ex; } } ExchangeUtil.getMessageForResponse(exchange) .setHeader(BlobServiceConstants.APPEND_BLOCK_CREATED, Boolean.TRUE); } private void updateAppendBlob(Exchange exchange) throws Exception { CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(exchange, getConfiguration()); configureCloudBlobForWrite(client); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (opts.getAccessCond() == null) { // Default: do not reset the blob content if the blob already exists opts.setAccessCond(AccessCondition.generateIfNotExistsCondition()); } Boolean appendBlobCreated = exchange.getIn().getHeader(BlobServiceConstants.APPEND_BLOCK_CREATED, Boolean.class); if (Boolean.TRUE != appendBlobCreated) { doCreateAppendBlob(client, opts, exchange); } InputStream inputStream = getInputStreamFromExchange(exchange); try { client.appendBlock(inputStream, -1, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } finally { closeInputStreamIfNeeded(inputStream); } } private void deleteAppendBlob(Exchange exchange) throws Exception { CloudAppendBlob client = BlobServiceUtil.createAppendBlobClient(exchange, getConfiguration()); doDeleteBlock(client, exchange); } private void createPageBlob(Exchange exchange) throws Exception { CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (opts.getAccessCond() == null) { // Default: do not reset the blob content if the blob already exists opts.setAccessCond(AccessCondition.generateIfNotExistsCondition()); } doCreatePageBlob(client, opts, exchange); } private void doCreatePageBlob(CloudPageBlob client, BlobServiceRequestOptions opts, Exchange exchange) throws Exception { if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Creating a page blob [{}] from exchange [{}]...", blobName, exchange); } Long pageSize = getPageBlobSize(exchange); try { client.create(pageSize, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } catch (StorageException ex) { if (ex.getHttpStatusCode() != 409) { throw ex; } } ExchangeUtil.getMessageForResponse(exchange) .setHeader(BlobServiceConstants.PAGE_BLOCK_CREATED, Boolean.TRUE); } private void uploadPageBlob(Exchange exchange) throws Exception { if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Updating a page blob [{}] from exchange [{}]...", blobName, exchange); } CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration()); configureCloudBlobForWrite(client); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (opts.getAccessCond() == null) { // Default: do not reset the blob content if the blob already exists opts.setAccessCond(AccessCondition.generateIfNotExistsCondition()); } Boolean pageBlobCreated = exchange.getIn().getHeader(BlobServiceConstants.PAGE_BLOCK_CREATED, Boolean.class); if (Boolean.TRUE != pageBlobCreated) { doCreatePageBlob(client, opts, exchange); } InputStream inputStream = getInputStreamFromExchange(exchange); doUpdatePageBlob(client, inputStream, opts, exchange); } private void resizePageBlob(Exchange exchange) throws Exception { if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Resizing a page blob [{}] from exchange [{}]...", blobName, exchange); } CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); Long pageSize = getPageBlobSize(exchange); client.resize(pageSize, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } private void clearPageBlob(Exchange exchange) throws Exception { if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Clearing a page blob [{}] from exchange [{}]...", blobName, exchange); } CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); Long blobOffset = getConfiguration().getBlobOffset(); Long blobDataLength = getConfiguration().getDataLength(); PageRange range = exchange.getIn().getHeader(BlobServiceConstants.PAGE_BLOB_RANGE, PageRange.class); if (range != null) { blobOffset = range.getStartOffset(); blobDataLength = range.getEndOffset() - range.getStartOffset(); } if (blobDataLength == null) { blobDataLength = blobOffset == 0 ? getPageBlobSize(exchange) : 512L; } client.clearPages(blobOffset, blobDataLength, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } private void doUpdatePageBlob(CloudPageBlob client, InputStream is, BlobServiceRequestOptions opts, Exchange exchange) throws Exception { Long blobOffset = getConfiguration().getBlobOffset(); Long blobDataLength = getConfiguration().getDataLength(); PageRange range = exchange.getIn().getHeader(BlobServiceConstants.PAGE_BLOB_RANGE, PageRange.class); if (range != null) { blobOffset = range.getStartOffset(); blobDataLength = range.getEndOffset() - range.getStartOffset(); } if (blobDataLength == null) { blobDataLength = (long) is.available(); } try { client.uploadPages(is, blobOffset, blobDataLength, opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); } finally { closeInputStreamIfNeeded(is); } } private void getPageBlobRanges(Exchange exchange) throws Exception { CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration()); BlobServiceUtil.configureCloudBlobForRead(client, getConfiguration()); BlobServiceRequestOptions opts = BlobServiceUtil.getRequestOptions(exchange); if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Getting the page blob ranges [{}] from exchange [{}]...", blobName, exchange); } List<PageRange> ranges = client.downloadPageRanges(opts.getAccessCond(), opts.getRequestOpts(), opts.getOpContext()); ExchangeUtil.getMessageForResponse(exchange).setBody(ranges); } private void deletePageBlob(Exchange exchange) throws Exception { CloudPageBlob client = BlobServiceUtil.createPageBlobClient(exchange, getConfiguration()); doDeleteBlock(client, exchange); } private Long getPageBlobSize(Exchange exchange) { Long pageSize = exchange.getIn().getHeader(BlobServiceConstants.PAGE_BLOB_SIZE, Long.class); if (pageSize == null) { pageSize = 512L; } return pageSize; } private void doDeleteBlock(CloudBlob client, Exchange exchange) throws Exception { if (LOG.isTraceEnabled()) { String blobName = getBlobName(exchange, getConfiguration()); LOG.trace("Deleting a blob [{}] from exchange [{}]...", blobName, exchange); } client.delete(); } private void configureCloudBlobForWrite(CloudBlob client) { if (getConfiguration().getStreamWriteSize() > 0) { client.setStreamWriteSizeInBytes(getConfiguration().getStreamWriteSize()); } if (getConfiguration().getBlobMetadata() != null) { client.setMetadata(new HashMap<>(getConfiguration().getBlobMetadata())); } } private BlobServiceOperations determineOperation(Exchange exchange) { BlobServiceOperations operation = exchange.getIn().getHeader(BlobServiceConstants.OPERATION, BlobServiceOperations.class); if (operation == null) { operation = getConfiguration().getOperation(); } return operation; } protected BlobServiceConfiguration getConfiguration() { return getEndpoint().getConfiguration(); } @Override public String toString() { return "StorageBlobProducer[" + URISupport.sanitizeUri(getEndpoint().getEndpointUri()) + "]"; } @Override public BlobServiceEndpoint getEndpoint() { return (BlobServiceEndpoint) super.getEndpoint(); } private InputStream getInputStreamFromExchange(Exchange exchange) throws Exception { Object body = exchange.getIn().getBody(); if (body instanceof WrappedFile) { // unwrap file body = ((WrappedFile) body).getFile(); } InputStream is; if (body instanceof InputStream) { is = (InputStream) body; } else if (body instanceof File) { is = new FileInputStream((File) body); } else if (body instanceof byte[]) { is = new ByteArrayInputStream((byte[]) body); } else { // try as input stream is = exchange.getContext().getTypeConverter().tryConvertTo(InputStream.class, exchange, body); } if (is == null) { // fallback to string based throw new IllegalArgumentException("Unsupported blob type:" + body.getClass().getName()); } return is; } private void closeInputStreamIfNeeded(InputStream inputStream) throws IOException { if (getConfiguration().isCloseStreamAfterWrite()) { inputStream.close(); } } }
{ "content_hash": "5326b644a5b540ddc2ca59a69e08ee06", "timestamp": "", "source": "github", "line_count": 512, "max_line_length": 130, "avg_line_length": 42.552734375, "alnum_prop": 0.6544269518520218, "repo_name": "DariusX/camel", "id": "cb05f4ac954df253a13dbd4c36fd4a4c607338e5", "size": "22589", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceProducer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Apex", "bytes": "6521" }, { "name": "Batchfile", "bytes": "2353" }, { "name": "CSS", "bytes": "17204" }, { "name": "Elm", "bytes": "10852" }, { "name": "FreeMarker", "bytes": "8015" }, { "name": "Groovy", "bytes": "14479" }, { "name": "HTML", "bytes": "909437" }, { "name": "Java", "bytes": "82050070" }, { "name": "JavaScript", "bytes": "102432" }, { "name": "Makefile", "bytes": "513" }, { "name": "Shell", "bytes": "17240" }, { "name": "TSQL", "bytes": "28692" }, { "name": "Tcl", "bytes": "4974" }, { "name": "Thrift", "bytes": "6979" }, { "name": "XQuery", "bytes": "546" }, { "name": "XSLT", "bytes": "271473" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <title>Test HTML</title> <script src="Listy.js"></script> </head> <body> <script> console.log(Solve(["def definition[-100, -100, -100]", "def definitionResult sum[definition]", "def defTest sum[definitionResult, 6457457, 2345234, -234546]", "avg[defTest, 1, 2, 3]"])); </script> </body> </html>
{ "content_hash": "d15d79ed3b9acddeb4f2b19ed0371b82", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 194, "avg_line_length": 29, "alnum_prop": 0.6264367816091954, "repo_name": "vladislav-karamfilov/TelerikAcademy", "id": "f7172c8af148e11bd6e764763a7b761cb2c2ea59", "size": "348", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "JavaScript Projects/JavaScript Exam (Evening)/Test.html", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "80863" }, { "name": "C#", "bytes": "4381282" }, { "name": "CSS", "bytes": "480577" }, { "name": "JavaScript", "bytes": "6109063" }, { "name": "PHP", "bytes": "34696" }, { "name": "Ruby", "bytes": "960" }, { "name": "Shell", "bytes": "21037" }, { "name": "Smalltalk", "bytes": "79233" }, { "name": "XSLT", "bytes": "4100" } ], "symlink_target": "" }
/** * @author Mugen87 / https://github.com/Mugen87 */ import { GameEntity } from '../../../../build/yuka.module.js'; class CustomObstacle extends GameEntity { constructor( geometry ) { super(); this.geometry = geometry; } handleMessage() { // do nothing return true; } } export { CustomObstacle };
{ "content_hash": "99a2ec121ba45487e4de31fd6e63e85f", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 62, "avg_line_length": 12, "alnum_prop": 0.6265432098765432, "repo_name": "Mugen87/yuka", "id": "681cf32ffd556ed23fee5586a083b97f6d37b61c", "size": "324", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/playground/hideAndSeek/src/CustomObstacle.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2138" }, { "name": "HTML", "bytes": "2186" }, { "name": "JavaScript", "bytes": "1906509" } ], "symlink_target": "" }
<!DOCTYPE html> <meta charset=utf-8> <title>invalid poster: userinfo-username-contains-pile-of-poo</title> <video poster="http://💩:foo@example.com"></video>
{ "content_hash": "17d8e13a35c20b4a477ab82ef878519b", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 69, "avg_line_length": 39.25, "alnum_prop": 0.732484076433121, "repo_name": "youtube/cobalt_sandbox", "id": "0275ab7e670fb6611554a6454c40def7564da0ff", "size": "160", "binary": false, "copies": "254", "ref": "refs/heads/main", "path": "third_party/web_platform_tests/conformance-checkers/html/elements/video/poster/userinfo-username-contains-pile-of-poo-novalid.html", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
#ifndef TARANTOOL_SAY_H_INCLUDED #define TARANTOOL_SAY_H_INCLUDED #include <stdlib.h> #include <stdarg.h> #include <errno.h> #include "trivia/util.h" /* for FORMAT_PRINTF */ #if defined(__cplusplus) extern "C" { #endif /* defined(__cplusplus) */ enum say_level { S_FATAL, /* do not this value use directly */ S_SYSERROR, S_ERROR, S_CRIT, S_WARN, S_INFO, S_DEBUG }; extern int log_fd; extern pid_t logger_pid; void say_logrotate(int /* signo */); void say_set_log_level(int new_level); /** Basic init. */ void say_init(const char *argv0); /* Move logging to a separate process. */ void say_logger_init(const char *logger, int log_level, int nonblock, int background); void vsay(int level, const char *filename, int line, const char *error, const char *format, va_list ap) __attribute__ ((format(FORMAT_PRINTF, 5, 0))); typedef void (*sayfunc_t)(int level, const char *filename, int line, const char *error, const char *format, ...); extern sayfunc_t _say __attribute__ ((format(FORMAT_PRINTF, 5, 6))); #define say(level, ...) ({ _say(level, __FILE__, __LINE__, __VA_ARGS__); }) #define panic_status(status, ...) ({ say(S_FATAL, NULL, __VA_ARGS__); exit(status); }) #define panic(...) panic_status(EXIT_FAILURE, __VA_ARGS__) #define panic_syserror(...) ({ say(S_FATAL, strerror(errno), __VA_ARGS__); exit(EXIT_FAILURE); }) #define say_syserror(...) say(S_SYSERROR, strerror(errno), __VA_ARGS__) #define say_error(...) say(S_ERROR, NULL, __VA_ARGS__) #define say_crit(...) say(S_CRIT, NULL, __VA_ARGS__) #define say_warn(...) say(S_WARN, NULL, __VA_ARGS__) #define say_info(...) say(S_INFO, NULL, __VA_ARGS__) #define say_debug(...) say(S_DEBUG, NULL, __VA_ARGS__) #if defined(__cplusplus) } /* extern "C" */ #endif /* defined(__cplusplus) */ #endif /* TARANTOOL_SAY_H_INCLUDED */
{ "content_hash": "ee1d70783b51d0f9b0d9a8e255cba99b", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 98, "avg_line_length": 28.333333333333332, "alnum_prop": 0.6251336898395722, "repo_name": "nvoron23/tarantool", "id": "b8132ef0f58f11bc14e9b5fb299643098764284e", "size": "3182", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/say.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "967515" }, { "name": "C++", "bytes": "899600" }, { "name": "CMake", "bytes": "85013" }, { "name": "GAP", "bytes": "3817" }, { "name": "Lua", "bytes": "486517" }, { "name": "Makefile", "bytes": "27" }, { "name": "Perl", "bytes": "9508" }, { "name": "Python", "bytes": "177814" }, { "name": "Ragel in Ruby Host", "bytes": "6352" }, { "name": "Ruby", "bytes": "2775" }, { "name": "Shell", "bytes": "3187" } ], "symlink_target": "" }
layout: post microblog: true audio: photo: date: 2011-03-14 08:41:11 -0600 guid: http://craigmcclellan.micro.blog/2011/03/14/t47306281396080640.html --- Also, when asked to tell me their name and an interesting fact. Abe Lincoln boy said "My name is Niles and I have a nut allergy."
{ "content_hash": "9af5f0b38423e1e4d6b31c6f79d9931e", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 129, "avg_line_length": 35.625, "alnum_prop": 0.7543859649122807, "repo_name": "craigwmcclellan/craigwmcclellan.github.io", "id": "b03310da34f7ab5c39a86b74d852a5411b022cf5", "size": "289", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2011-03-14-t47306281396080640.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "27257" }, { "name": "HTML", "bytes": "34777166" }, { "name": "Ruby", "bytes": "13054" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Draggable - Delay start</title> <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> <script src="../../jquery-1.7.1.js"></script> <script src="../../ui/jquery.ui.core.js"></script> <script src="../../ui/jquery.ui.widget.js"></script> <script src="../../ui/jquery.ui.mouse.js"></script> <script src="../../ui/jquery.ui.draggable.js"></script> <link rel="stylesheet" href="../demos.css"> <style> #draggable, #draggable2 { width: 120px; height: 120px; padding: 0.5em; float: left; margin: 0 10px 10px 0; } </style> <script> $(function() { $( "#draggable" ).draggable({ distance: 20 }); $( "#draggable2" ).draggable({ delay: 1000 }); $( ".ui-draggable" ).disableSelection(); }); </script> </head> <body> <div class="demo"> <div id="draggable" class="ui-widget-content"> <p>Only if you drag me by 20 pixels, the dragging will start</p> </div> <div id="draggable2" class="ui-widget-content"> <p>Regardless of the distance, you have to drag and wait for 1000ms before dragging starts</p> </div> </div><!-- End demo --> <div class="demo-description"> <p>Delay the start of dragging for a number of milliseconds with the <code>delay</code> option; prevent dragging until the cursor is held down and dragged a specifed number of pixels with the <code>distance</code> option. </p> </div><!-- End demo-description --> </body> </html>
{ "content_hash": "25524f6c783125d5d4d73cabbc7e02c1", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 226, "avg_line_length": 33.22222222222222, "alnum_prop": 0.6367892976588628, "repo_name": "TheOpenCloudEngine/metaworks", "id": "d17247894ad0a5917e0b7d2797fd3613e65c8342", "size": "1495", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "metaworks3/src/main/webapp/scripts/jquery.jqGrid-4.3.1/jquery-ui-1.8.17.custom/development-bundle/demos/draggable/delay-start.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "59" }, { "name": "CSS", "bytes": "406065" }, { "name": "FreeMarker", "bytes": "676" }, { "name": "HTML", "bytes": "1199869" }, { "name": "Java", "bytes": "6080475" }, { "name": "JavaScript", "bytes": "3892219" }, { "name": "PHP", "bytes": "27920" }, { "name": "XSLT", "bytes": "114271" } ], "symlink_target": "" }
/** * Handles the import requests */ /* * 2011 Peter 'Pita' Martischka (Primary Technology Ltd) * 2012 Iván Eixarch * 2014 John McLear (Etherpad Foundation / McLear Ltd) * * 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. */ var ERR = require("async-stacktrace") , padManager = require("../db/PadManager") , padMessageHandler = require("./PadMessageHandler") , async = require("async") , fs = require("fs") , path = require("path") , settings = require('../utils/Settings') , formidable = require('formidable') , os = require("os") , importHtml = require("../utils/ImportHtml") , importEtherpad = require("../utils/ImportEtherpad") , log4js = require("log4js") , hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks.js"); //load abiword only if its enabled if(settings.abiword != null) var abiword = require("../utils/Abiword"); //for node 0.6 compatibily, os.tmpDir() only works from 0.8 var tmpDirectory = process.env.TEMP || process.env.TMPDIR || process.env.TMP || '/tmp'; /** * do a requested import */ exports.doImport = function(req, res, padId) { var apiLogger = log4js.getLogger("ImportHandler"); //pipe to a file //convert file to html via abiword //set html in the pad var srcFile, destFile , pad , text , importHandledByPlugin , directDatabaseAccess; var randNum = Math.floor(Math.random()*0xFFFFFFFF); async.series([ //save the uploaded file to /tmp function(callback) { var form = new formidable.IncomingForm(); form.keepExtensions = true; form.uploadDir = tmpDirectory; form.parse(req, function(err, fields, files) { //the upload failed, stop at this point if(err || files.file === undefined) { if(err) console.warn("Uploading Error: " + err.stack); callback("uploadFailed"); } //everything ok, continue else { //save the path of the uploaded file srcFile = files.file.path; callback(); } }); }, //ensure this is a file ending we know, else we change the file ending to .txt //this allows us to accept source code files like .c or .java function(callback) { var fileEnding = path.extname(srcFile).toLowerCase() , knownFileEndings = [".txt", ".doc", ".docx", ".pdf", ".odt", ".html", ".htm", ".etherpad"] , fileEndingKnown = (knownFileEndings.indexOf(fileEnding) > -1); //if the file ending is known, continue as normal if(fileEndingKnown) { callback(); } //we need to rename this file with a .txt ending else { if(settings.allowUnknownFileEnds === true){ var oldSrcFile = srcFile; srcFile = path.join(path.dirname(srcFile),path.basename(srcFile, fileEnding)+".txt"); fs.rename(oldSrcFile, srcFile, callback); }else{ console.warn("Not allowing unknown file type to be imported", fileEnding); callback("uploadFailed"); } } }, function(callback){ destFile = path.join(tmpDirectory, "etherpad_import_" + randNum + ".htm"); // Logic for allowing external Import Plugins hooks.aCallAll("import", {srcFile: srcFile, destFile: destFile}, function(err, result){ if(ERR(err, callback)) return callback(); if(result.length > 0){ // This feels hacky and wrong.. importHandledByPlugin = true; callback(); }else{ callback(); } }); }, function(callback) { var fileEnding = path.extname(srcFile).toLowerCase() var fileIsEtherpad = (fileEnding === ".etherpad"); if(fileIsEtherpad){ // we do this here so we can see if the pad has quit ea few edits padManager.getPad(padId, function(err, _pad){ var headCount = _pad.head; if(headCount >= 10){ apiLogger.warn("Direct database Import attempt of a pad that already has content, we wont be doing this") return callback("padHasData"); }else{ fs.readFile(srcFile, "utf8", function(err, _text){ directDatabaseAccess = true; importEtherpad.setPadRaw(padId, _text, function(err){ callback(); }); }); } }); }else{ callback(); } }, //convert file to html function(callback) { if(!importHandledByPlugin || !directDatabaseAccess){ var fileEnding = path.extname(srcFile).toLowerCase(); var fileIsHTML = (fileEnding === ".html" || fileEnding === ".htm"); if (abiword && !fileIsHTML) { abiword.convertFile(srcFile, destFile, "htm", function(err) { //catch convert errors if(err) { console.warn("Converting Error:", err); return callback("convertFailed"); } else { callback(); } }); } else { // if no abiword only rename fs.rename(srcFile, destFile, callback); } }else{ callback(); } }, function(callback) { if (!abiword){ if(!directDatabaseAccess) { // Read the file with no encoding for raw buffer access. fs.readFile(destFile, function(err, buf) { if (err) throw err; var isAscii = true; // Check if there are only ascii chars in the uploaded file for (var i=0, len=buf.length; i<len; i++) { if (buf[i] > 240) { isAscii=false; break; } } if (isAscii) { callback(); } else { callback("uploadFailed"); } }); }else{ callback(); } } else { callback(); } }, //get the pad object function(callback) { padManager.getPad(padId, function(err, _pad){ if(ERR(err, callback)) return; pad = _pad; callback(); }); }, //read the text function(callback) { if(!directDatabaseAccess){ fs.readFile(destFile, "utf8", function(err, _text){ if(ERR(err, callback)) return; text = _text; // Title needs to be stripped out else it appends it to the pad.. text = text.replace("<title>", "<!-- <title>"); text = text.replace("</title>","</title>-->"); //node on windows has a delay on releasing of the file lock. //We add a 100ms delay to work around this if(os.type().indexOf("Windows") > -1){ setTimeout(function() {callback();}, 100); } else { callback(); } }); }else{ callback(); } }, //change text of the pad and broadcast the changeset function(callback) { if(!directDatabaseAccess){ var fileEnding = path.extname(srcFile).toLowerCase(); if (abiword || fileEnding == ".htm" || fileEnding == ".html") { try{ importHtml.setPadHTML(pad, text); }catch(e){ apiLogger.warn("Error importing, possibly caused by malformed HTML"); } } else { pad.setText(text); } } // Load the Pad into memory then brodcast updates to all clients padManager.unloadPad(padId); padManager.getPad(padId, function(err, _pad){ var pad = _pad; padManager.unloadPad(padId); // direct Database Access means a pad user should perform a switchToPad // and not attempt to recieve updated pad data.. if(!directDatabaseAccess){ padMessageHandler.updatePadClients(pad, function(){ callback(); }); }else{ callback(); } }); }, //clean up temporary files function(callback) { if(!directDatabaseAccess){ //for node < 0.7 compatible var fileExists = fs.exists || path.exists; async.parallel([ function(callback){ fileExists (srcFile, function(exist) { (exist)? fs.unlink(srcFile, callback): callback(); }); }, function(callback){ fileExists (destFile, function(exist) { (exist)? fs.unlink(destFile, callback): callback(); }); } ], callback); }else{ callback(); } } ], function(err) { var status = "ok"; //check for known errors and replace the status if(err == "uploadFailed" || err == "convertFailed" || err == "padHasData") { status = err; err = null; } ERR(err); //close the connection res.send( "<head> \ <script type='text/javascript' src='../../static/js/jquery.js'></script> \ </head> \ <script> \ $(window).load(function(){ \ if(navigator.userAgent.indexOf('MSIE') === -1){ \ document.domain = document.domain; \ } \ var impexp = window.parent.padimpexp.handleFrameCall('" + directDatabaseAccess +"', '" + status + "'); \ }) \ </script>" , 200); }); }
{ "content_hash": "d8cfee4c88e29c5e5bccd45d11c42ca1", "timestamp": "", "source": "github", "line_count": 309, "max_line_length": 117, "avg_line_length": 31.488673139158575, "alnum_prop": 0.5598150051387462, "repo_name": "meticulo3366/etherpad-lite", "id": "a511637cc1d550a13936c526a1b77eeb8ad4750f", "size": "9731", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/node/handler/ImportHandler.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "49017" }, { "name": "JavaScript", "bytes": "1372130" }, { "name": "Makefile", "bytes": "632" }, { "name": "Python", "bytes": "1394" }, { "name": "Shell", "bytes": "12637" }, { "name": "TeX", "bytes": "21375" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="io.github.hebury.bioscoopcasus.MainActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" android:theme="@style/AppTheme" app:popupTheme="@style/PopupOverlay" app:titleTextColor="@color/colorPrimaryText" app:subtitleTextColor="@color/colorSecondaryText"/> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_main" /> </android.support.design.widget.CoordinatorLayout>
{ "content_hash": "cf872df9f9ff6501892ec646a0ea9fbb", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 107, "avg_line_length": 42.357142857142854, "alnum_prop": 0.6888701517706577, "repo_name": "Hebury/BioscoopCasus", "id": "5e924f5f77b7fa35f04feb8f469d35ca78fd6adc", "size": "1186", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/layout/app_bar_main.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "83279" } ], "symlink_target": "" }
using System; using System.Windows; namespace PathOfFilters { /// <summary> /// Interaction logic for Settings.xaml /// </summary> public partial class Settings : Window { private MainWindow _main; public Settings() { InitializeComponent(); _main = MainWindow.GetSingleton(); TextBoxUsername.Text = Properties.Settings.Default.PastebinUsername; PasswordPasteBin.Password = Properties.Settings.Default.PastebinPassword != string.Empty ? Crypto.DecryptStringAES(Properties.Settings.Default.PastebinPassword, MainWindow.CRYPT_KEY) : ""; } private void CheckBoxPasteBin_Checked(object sender, RoutedEventArgs e) { GroupPasteBin.IsEnabled = true; } private void CheckBoxPasteBin_Unchecked(object sender, RoutedEventArgs e) { GroupPasteBin.IsEnabled = false; } private void ButtonFileBrowse_Click(object sender, RoutedEventArgs e) { var fileBrowser = new Microsoft.Win32.OpenFileDialog { Title = "Locate your filter file", DefaultExt = ".txt", Filter = "Text Files (*.txt)|*.txt" }; var result = fileBrowser.ShowDialog(); if (result != true) return; TextBoxFilterFile.Text = fileBrowser.FileName; } private void ButtonVerify_Click(object sender, RoutedEventArgs e) { var pastebin = _main.Pastebin; pastebin.Username = TextBoxUsername.Text; pastebin.Password = PasswordPasteBin.Password; var user = _main.Pastebin.PastebinUser; if (user == null) return; Properties.Settings.Default.PastebinUsername = pastebin.Username; Properties.Settings.Default.PastebinPassword = Crypto.EncryptStringAES(pastebin.Password, MainWindow.CRYPT_KEY); } private void ButtonSave_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.Save(); } } }
{ "content_hash": "30412899bf96adae823c912ddd959428", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 124, "avg_line_length": 35.38333333333333, "alnum_prop": 0.6095148374941121, "repo_name": "M1nistry/PathOfFilters", "id": "3f9b8803ba880bab51ceb7bbcd99fa1b6c282627", "size": "2125", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Path of Filters/Settings.xaml.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "129550" } ], "symlink_target": "" }
struct TagItem *NextTagItem(pUtility UtilBase, const struct TagItem **tagListPtr); struct TagItem *FindTagItem(pUtility UtilBase, UINT32 tagValue, const struct TagItem *tagList); BOOL TagInArray(pUtility UtilBase, UINT32 tagValue, UINT32 *tagArray); UINT32 GetTagData(pUtility UtilBase, Tag tagValue, UINT32 defaultVal, const struct TagItem *tagList); struct TagItem *AllocateTagItems(pUtility UtilBase, UINT32 numTags); void FreeTagItems(pUtility UtilBase, struct TagItem *tagList); void RefreshTagItemClones(pUtility UtilBase, struct TagItem *clone, const struct TagItem *original); struct TagItem *CloneTagItems(pUtility UtilBase, const struct TagItem *tagList); UINT32 PackBoolTags(pUtility UtilBase, UINT32 initialFlags, struct TagItem *tagList, struct TagItem *boolMap); UINT32 FilterTagItems(pUtility UtilBase, struct TagItem *tagList, Tag *filterArray, UINT32 logic); void FilterTagChanges(pUtility UtilBase, struct TagItem *changeList, const struct TagItem *originalList, BOOL apply); void MapTags(pUtility UtilBase, struct TagItem *tagList, struct TagItem *mapList, UINT32 mapType); void ApplyTagChanges(pUtility UtilBase, struct TagItem *list, struct TagItem *changelist); UINT32 CalcDate(pUtility UtilBase, UINT32 year, UINT32 month, UINT32 day); void Amiga2Date(pUtility UtilBase, UINT32 amiga, struct ClockData *cd); UINT32 Date2Amiga(pUtility UtilBase, struct ClockData *cd); UINT32 CheckDate(pUtility UtilBase, struct ClockData *date); STRPTR NamedObjectName(pUtility UtilBase, struct NamedObject *nos); struct NamedObject *FindNamedObject(pUtility UtilBase, struct NamedObject *nameSpace, STRPTR name, struct NamedObject *lastObject); BOOL AddNamedObject(pUtility UtilBase, struct NamedObject *nameSpace, struct NamedObject *object); BOOL AttemptRemNamedObject(pUtility UtilBase, struct NamedObject *nos); BOOL RemNamedObject(pUtility UtilBase, struct NamedObject *object, struct Message *message); BOOL ReleaseNamedObject(pUtility UtilBase, struct NamedObject *object); struct NamedObject *AllocNamedObjectA(pUtility UtilBase, STRPTR name, struct TagItem *tagList); void FreeNamedObject(pUtility UtilBase, struct NamedObject *object); UINT8 ToUpper(pUtility UtilBase, UINT8 c); UINT8 ToLower(pUtility UtilBase, UINT8 c); INT32 Strlen(pUtility UtilBase, const char *str); UINT8 *Strncpy(pUtility UtilBase, char *dst, const char *src, INT32 n); INT32 Stricmp(pUtility UtilBase, const char *s1, const char *s2); INT32 Strnicmp(pUtility UtilBase, const char *s1, const char *s2, INT32 n); INT32 Strcmp(pUtility UtilBase, const char *s1, const char *s2); char *Strcpy(pUtility UtilBase, char *to, const char *from); STRPTR util_Strrchr( pUtility UtilBase, CONST_STRPTR s, int c ); UINT32 util_Strcspn( pUtility UtilBase, CONST_STRPTR s1, CONST_STRPTR s2 ); #endif #if 0 #include "utility.h" #define NextTagItem(a) (((struct TagItem *(*)(pUtility UtilBase, const struct TagItem **tagListPtr)) _GETVECADDR(UtilBase, 5))(UtilBase,a)) #define FindTagItem(a,b) (((struct TagItem *(*)(pUtility UtilBase, UINT32 tagValue, const struct TagItem *tagList)) _GETVECADDR(UtilBase, 6))(UtilBase,a,b)) #define TagInArray(a,b) (((BOOL (*)(pUtility UtilBase, UINT32 tagValue, UINT32 *tagArray)) _GETVECADDR(UtilBase, 7))(UtilBase,a,b)) #define GetTagData(a,b,c) (((UINT32(*)(pUtility UtilBase, Tag tagValue, UINT32 defaultVal, const struct TagItem *tagList)) _GETVECADDR(UtilBase, 8))(UtilBase,a,b,c)) #define AllocateTagItems(a) (((struct TagItem *(*)(pUtility UtilBase, UINT32 numTags)) _GETVECADDR(UtilBase, 9))(UtilBase,a)) #define FreeTagItems(a) (((void (*)(pUtility UtilBase, struct TagItem *tagList)) _GETVECADDR(UtilBase,10))(UtilBase,a)) #define RefreshTagItemClones(a,b) (((void (*)(pUtility UtilBase, struct TagItem *clone, const struct TagItem *original)) _GETVECADDR(UtilBase,11))(UtilBase,a,b)) #define CloneTagItems(a) (((struct TagItem *(*)(pUtility UtilBase, const struct TagItem *tagList)) _GETVECADDR(UtilBase,12))(UtilBase,a)) #define PackBoolTags(a,b,c) (((UINT32(*)(pUtility UtilBase, UINT32 initialFlags, struct TagItem *tagList, struct TagItem *boolMap)) _GETVECADDR(UtilBase,13))(UtilBase,a,b,c)) #define FilterTagItems(a,b,c) (((UINT32(*)(pUtility UtilBase, struct TagItem *tagList, Tag *filterArray, UINT32 logic)) _GETVECADDR(UtilBase,14))(UtilBase,a,b,c)) #define FilterTagChanges(a,b,c) (((void (*)(pUtility UtilBase, struct TagItem *changeList, const struct TagItem *originalList, BOOL apply)) _GETVECADDR(UtilBase,15))(UtilBase,a,b,c)) #define MapTags(a,b,c) (((void (*)(pUtility UtilBase, struct TagItem *tagList, struct TagItem *mapList, UINT32 mapType)) _GETVECADDR(UtilBase,16))(UtilBase,a,b,c)) #define ApplyTagChanges(a,b) (((void (*)(pUtility UtilBase, struct TagItem *list, struct TagItem *changelist)) _GETVECADDR(UtilBase,17))(UtilBase,a,b)) #define CalcDate(a,b,c) (((UINT32(*)(pUtility UtilBase, UINT32 year, UINT32 month, UINT32 day)) _GETVECADDR(UtilBase,18))(UtilBase,a,b,c)) #define Amiga2Date(a,b) (((void (*)(pUtility UtilBase, UINT32 amiga, struct ClockData *cd)) _GETVECADDR(UtilBase,19))(UtilBase,a,b)) #define Date2Amiga(a) (((UINT32(*)(pUtility UtilBase, struct ClockData *cd)) _GETVECADDR(UtilBase,20))(UtilBase,a)) #define CheckDate(a) (((UINT32(*)(pUtility UtilBase, struct ClockData *date)) _GETVECADDR(UtilBase,21))(UtilBase,a)) #define NamedObjectName(a) (((STRPTR(*)(pUtility UtilBase, struct NamedObject *nos)) _GETVECADDR(UtilBase,22))(UtilBase,a)) #define FindNamedObject(a,b,c) (((struct NamedObject *(*)(pUtility UtilBase, struct NamedObject *nameSpace, STRPTR name, struct NamedObject *lastObject)) _GETVECADDR(UtilBase,23))(UtilBase,a,b,c)) #define AddNamedObject(a,b) (((BOOL(*)(pUtility UtilBase, struct NamedObject *nameSpace, struct NamedObject *object)) _GETVECADDR(UtilBase,24))(UtilBase,a,b)) #define AttemptRemNamedObject(a) (((BOOL(*)(pUtility UtilBase, struct NamedObject *nos)) _GETVECADDR(UtilBase,25))(UtilBase,a)) #define RemNamedObject(a,b) (((BOOL(*)(pUtility UtilBase, struct NamedObject *object, struct Message *message)) _GETVECADDR(UtilBase,26))(UtilBase,a,b)) #define ReleaseNamedObject(a) (((BOOL(*)(pUtility UtilBase, struct NamedObject *object)) _GETVECADDR(UtilBase,27))(UtilBase,a)) #define AllocNamedObjectA(a,b) (((struct NamedObject *(*)(pUtility UtilBase, STRPTR name, struct TagItem *tagList)) _GETVECADDR(UtilBase,28))(UtilBase,a,b)) #define FreeNamedObject(a) (((void(*)(pUtility UtilBase, struct NamedObject *object)) _GETVECADDR(UtilBase,29))(UtilBase,a)) #define ToUpper(a) (((UINT8 (*)(pUtility UtilBase, UINT8 c)) _GETVECADDR(UtilBase,30))(UtilBase,a)) #define ToLower(a) (((UINT8 (*)(pUtility UtilBase, UINT8 c)) _GETVECADDR(UtilBase,31))(UtilBase,a)) #define Strlen(a) (((INT32 (*)(pUtility UtilBase, const char *str)) _GETVECADDR(UtilBase,32))(UtilBase,a)) #define Strncpy(a,b,c) (((UINT8*(*)(pUtility UtilBase, char *dst, const char *src, INT32 n)) _GETVECADDR(UtilBase,33))(UtilBase,a,b,c)) #define Stricmp(a,b) (((INT32 (*)(pUtility UtilBase, const char *s1, const char *s2)) _GETVECADDR(UtilBase,34))(UtilBase,a,b)) #define Strnicmp(a,b,c) (((INT32 (*)(pUtility UtilBase, const char *s1, const char *s2, INT32 n)) _GETVECADDR(UtilBase,35))(UtilBase,a,b,c)) #define Strcmp(a,b) (((INT32 (*)(pUtility UtilBase, const char *s1, const char *s2)) _GETVECADDR(UtilBase,36))(UtilBase,a,b)) #define Strcpy(a,b) (((char *(*)(pUtility UtilBase, char *to, const char *from)) _GETVECADDR(UtilBase,37))(UtilBase,a,b)) #define Rand() (((INT32(*)(pUtility UtilBase)) _GETVECADDR(UtilBase,38))(UtilBase)) #define Random() (((INT32(*)(pUtility UtilBase)) _GETVECADDR(UtilBase,39))(UtilBase)) #define SRand(a) (((void (*)(pUtility UtilBase,UINT32 seed)) _GETVECADDR(UtilBase,40))(UtilBase,a)) #define SRandom(a) (((void (*)(pUtility UtilBase,UINT32 seed)) _GETVECADDR(UtilBase,41))(UtilBase,a)) #define Strchr(a,b) (((STRPTR(*)(pUtilBase, const STRPTR, INT32)) _GETVECADDR(UtilBase,42))(UtilBase,a,b)) #define Strtok(a,b) (((STRPTR(*)(pUtilBase, STRPTR, CONST_STRPTR)) _GETVECADDR(UtilBase,43))(UtilBase,a,b)) #define Strtok_r(a,b,c) (((STRPTR(*)(pUtilBase, STRPTR, CONST_STRPTR, char **)) _GETVECADDR(UtilBase,44))(UtilBase,a,b,c)) #define Strpbrk(a,b) (((STRPTR(*)(pUtilBase, CONST_STRPTR, CONST_STRPTR)) _GETVECADDR(UtilBase,45))(UtilBase,a,b)) #define Strspn(a,b) (((INT32(*)(pUtilBase, CONST_STRPTR, CONST_STRPTR)) _GETVECADDR(UtilBase,46))(UtilBase,a,b)) #define Strrchr(a,b) (((STRPTR(*)(pUtilBase, CONST_STRPTR, INT32)) _GETVECADDR(UtilBase,47))(UtilBase,a,b)) #define Strcspn(a,b) (((INT32(*)(pUtilBase, CONST_STRPTR, CONST_STRPTR)) _GETVECADDR(UtilBase,48))(UtilBase,a,b)) #define CallHookPkt(a,b,c) (((INT32(*)(pUtilBase, struct Hook*, APTR, APTR)) _GETVECADDR(UtilBase,49))(UtilBase,a,b,c)) #define Strcat(a,b) (((STRPTR(*)(pUtilBase, STRPTR, CONST_STRPTR)) _GETVECADDR(UtilBase,50))(UtilBase,a,b)) #endif
{ "content_hash": "6302f70366adae5c3a701e4411a8c39a", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 197, "avg_line_length": 90.96, "alnum_prop": 0.7296613896218118, "repo_name": "cycl0ne/poweros_x86", "id": "5bae06448cce5b601d1a33e7653b5b97a671b859", "size": "9123", "binary": false, "copies": "1", "ref": "refs/heads/v0.2", "path": "lib/utility/utility_funcs.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "7429" }, { "name": "C", "bytes": "1784150" }, { "name": "C++", "bytes": "65092" }, { "name": "Makefile", "bytes": "25544" }, { "name": "Objective-C", "bytes": "5379" }, { "name": "Shell", "bytes": "2437" } ], "symlink_target": "" }
DROP KEYSPACE IF EXISTS employerratings; CREATE KEYSPACE employerratings WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; CREATE TABLE employerratings.ratings (id TIMEUUID PRIMARY KEY, user INT, product INT, rating DOUBLE); CREATE TABLE employerratings.validation (id TIMEUUID PRIMARY KEY, user INT, product INT, rating DOUBLE);
{ "content_hash": "21905f6d0d6aa5ca155e896b63aa6ead", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 105, "avg_line_length": 88.5, "alnum_prop": 0.7994350282485876, "repo_name": "peteralcock/busher_pusher", "id": "b10a3d842442f5995a7386dee1a3720fa5308727", "size": "372", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "matchmaker/src/sql/collab_filter_setup.sql", "mode": "33261", "license": "mit", "language": [ { "name": "Java", "bytes": "20611" }, { "name": "Python", "bytes": "954" }, { "name": "Ruby", "bytes": "736" }, { "name": "Shell", "bytes": "2316" } ], "symlink_target": "" }
function cMultiImageTestPanel() { // This is a test mode panel only! var self = this; // local var for closure var jPanel; // for quick access var jSelected; var jPinned; var jSampleTypes; var nImages; var imageIdList = []; var selImageIdx; var posImageIdx; var negImageIdx; us.idMITESTPANEL = "us_mitestpanel"; us.clsMITESTSEL = "us_clsmitestsel"; us.clsMITESTPIN = "us_clsmitestpin"; us.clsMITESTTYPE = "us_clsmitesttype"; us.idINVERTCONTROLBTN = "us_invertcontrolbtn"; //............................................ show() public this.show = function (show) { if (show == true) jPanel.dialog("open"); else jPanel.dialog("close"); }; //............................................ bindEvents_() local // bindEvents_ - This function adds the multi-image event handlers. // // Note that by using the same namespace as the viewport when the // viewport removes its events by namespace, these are also removed. var bindEvents_ = function () { var namespace = thisImg.eventNameSpaceGet(); var bPINNED = true, bNOTPINNED = false; // handy var mag = 4; // open all images at 4x var internalRadioChange = false; var buildImageJSON_ = function (imageId, opt_mag, opt_sampleType, opt_bPinned) { var json = { "imagePath": imageId, "fullURL": buildFULLURL_(imageId) }; if (opt_mag) json.mag = opt_mag; if (opt_sampleType) json.sampleType = opt_sampleType; if (opt_bPinned) json.isPinned = opt_bPinned; return json; }; var changeOpenedImageState_ = function (idx, newSampleType, bPinned) { if (imageIdList[idx].isOpen == false) return false; imageIdList[idx].isPinned = bPinned; jPinned[idx].checked = bPinned; var imageSet = { "images": [buildImageJSON_(imageIdList[idx].imageId, undefined, newSampleType, bPinned)] }; return uScope.imageUpdate("state", imageSet.images); }; var sampleTypeGet_ = function (idx) { var sampleType = 'patient'; if (posImageIdx == idx) sampleType = 'positive'; else if (negImageIdx == idx) sampleType = 'negative'; return sampleType; }; var pinnedList_ = function () { var list = []; for (var t = 0; t < nImages; t++) { if (imageIdList[t].isPinned == true) list.push(imageIdList[t]); } return list; }; var openedList_ = function () { var list = []; for (var t = 0; t < nImages; t++) { if (imageIdList[t].isOpen == true) list.push(imageIdList[t]); } return list; }; $(us.idHashROOT).on('click' + namespace, "." + us.clsMITESTSEL, function (e) { // selected image var target = e.currentTarget; var idx = +target.value; consoleWrite(target.className + ": " + idx + " - " + imageIdList[idx].imageId); if (imageIdList[idx].isPinned == true) { consoleWrite("Cannot select a pinned image"); return false; } if (imageIdList[idx].isOpen == true) { consoleWrite("Image already opened...ERROR?"); return false; } //can this happen? // selecting an image opens it and closes the previously selected image .. image replace if (selImageIdx != undefined) { var imageSet2 = { "images": [buildImageJSON_(imageIdList[idx].imageId, mag, sampleTypeGet_(idx), bNOTPINNED)] }; if (imageIdList[selImageIdx].isPinned == true) {// if currently selected image is pinned, add this image var status = uScope.imageUpdate("add", imageSet2.images); } else { // if currently selected image is NOT pinned, replace it with this image var imageSet1 = { "images": [buildImageJSON_(imageIdList[selImageIdx].imageId)] }; var status = uScope.imageUpdate("replace", imageSet1.images, imageSet2.images); imageIdList[selImageIdx].isOpen = false; } imageIdList[idx].isOpen = true; selImageIdx = idx; // update selected image index } else { genericMessage("Curiously no previous image was selected"); } // return false; // return of false reverts radio btn selection! }); $(us.idHashROOT).on('click' + namespace, "." + us.clsMITESTPIN, function (e) { // selected image var target = e.currentTarget; var imageId = target.name; var isPinned = target.checked; idx = target.value; consoleWrite(target.className + ": " + imageId + " isPinned: " + isPinned); if (target.checked == true && selImageIdx == idx) { consoleWrite("Cannot pin the selected image"); return false; } if (isPinned == true) { //..... checking means pin the image, select the image and open it var pinList = pinnedList_(); var openList = openedList_(); if (pinList.length == 3) { consoleWrite("Only 3 images can be pinned"); return false; } var imageSet = { "images": [buildImageJSON_(imageId, mag, sampleTypeGet_(idx), bPINNED)] }; uScope.imageUpdate("add", imageSet.images); imageIdList[idx].isPinned = true; imageIdList[idx].isOpen = true; // pinning does not change the selected state selImageIdx = idx; // update selected image index } else { //..... unchecking means unpin the image and close it var imageSet = { "images": [buildImageJSON_(imageId)] }; uScope.imageUpdate("remove", imageSet.images); imageIdList[idx].isPinned = false; imageIdList[idx].isOpen = false; if (selImageIdx == idx) selImageIdx = undefined; //will there be a selected image confusion? } }); $(us.idHashROOT).on('click' + namespace, "#" + us.idINVERTCONTROLBTN, function (e) { // swap positive and negative control sampleTypes // if there are open positive and negative controls... if (posImageIdx != undefined && negImageIdx != undefined && imageIdList[posImageIdx].isOpen == true && imageIdList[negImageIdx].isOpen == true) { var imageSet = { "images": [buildImageJSON_(imageIdList[posImageIdx].imageId, undefined, 'negative') , buildImageJSON_(imageIdList[negImageIdx].imageId, undefined, 'positive')] }; uScope.imageUpdate("state", imageSet.images); internalRadioChange = true; jSampleTypes[3 * posImageIdx + 2].click(); // change positive control radio button state to negative jSampleTypes[3 * negImageIdx + 1].click(); // change negative control radio button state to positive internalRadioChange = false; idx = posImageIdx posImageIdx = negImageIdx; // update the positive image index negImageIdx = idx; // update the negative image index } }); $(us.idHashROOT).on('click' + namespace, "." + us.clsMITESTTYPE, function (e) { // selected image var target = e.currentTarget; var idx = target.name; var sampleType = target.value; consoleWrite(target.className + " index: " + idx + " sampleType: " + sampleType + " - " + imageIdList[idx].imageId); if (sampleType == "patient") { // .....if changing from a control to a patient sample type // if there is a DST selected image then dragging a control to the tray (represetned here by changing state from control to patient) // results in either keeping it pinned or closing the control image..... changeOpenedImageState_(idx, sampleType, bPINNED); // keep image pinned // note that this image is NOT the selected image if (posImageIdx == idx) posImageIdx = undefined; else if (negImageIdx == idx) negImageIdx = undefined; jSampleTypes[3 * idx].click(); // change this image's radio button state back to patient } else if (sampleType == "positive") { if (negImageIdx == idx) return internalRadioChange; // swap pos to neg control via button - this statement catches swap control button click! ////////////////////////////// //if keeping pinned, need to insure that no more than 3 are pinned.. messy!!!! and do for negative!!! ////////////////////////////// if (posImageIdx != undefined) { // ..... if a positive control is already defined then 1st tranisition it back to a patient sample changeOpenedImageState_(posImageIdx, 'patient', bNOTPINNED); //? when changing from control to patient, unpin ?????? jSampleTypes[3 * posImageIdx].click(); // and change its radio button state back to patient } changeOpenedImageState_(idx, sampleType, bPINNED); posImageIdx = idx; // update the positive image index return; } else if (sampleType == "negative") { if (posImageIdx == idx) return internalRadioChange; // swap pos to neg control via button - this statement catches swap control button click! if (negImageIdx != undefined) { // ..... if a negative control is already defined then 1st tranisition it back to a patient sample // if there is a DST selected image then dragging a control to the tray (represetned here by changing state from control to patient) // results in either keeping it pinned or closing the control image..... changeOpenedImageState_(negImageIdx, 'patient', bNOTPINNED); //? when changing from control to patient, unpin ??????? ///////???? //-- has to close or 2 open and only one selected -- or stay pinned jSampleTypes[3 * negImageIdx].click(); // and change its radio button state back to patient } changeOpenedImageState_(idx, sampleType, bPINNED); negImageIdx = idx; // update the negative image index return; } }); $(us.idHashROOT).on(us.evOPENNEXTSLIDE + namespace, function (e, parms) { consoleWrite("...... test panel event: " + us.evOPENNEXTSLIDE + " " + toStringAssoc(parms, " ")); var nextIdx_ = function (idx) { var next = +idx + 1; if (next == nImages) next = 0; return next; }; // find the next unopened image var nextIdx = nextIdx_(selImageIdx); while (imageIdList[nextIdx].isOpen == true && nextIdx != selImageIdx) { nextIdx = nextIdx_(nextIdx); }; if (nextIdx != selImageIdx) jSelected[nextIdx].click(); }); $(us.idHashROOT).on(us.evOPENPREVSLIDE + namespace, function (e, parms) { consoleWrite("...... test panel event: " + us.evOPENPREVSLIDE + " " + toStringAssoc(parms, " ")); var newSelImageIdx = selImageIdx - 1; if (newSelImageIdx < 0) newSelImageIdx = nImages - 1; jSelected[newSelImageIdx].click(); }); }; //............................................ buildFULLURL_() local var buildFULLURL_ = function (imageId) {//imageId has leading @ sign var rtnURL; var fullURL = uScope.getFullURL(); //assumes a selected image if (fullURL != undefined) { var idx = fullURL.lastIndexOf("@"); if (idx > 0) rtnURL = fullURL.substr(0, idx) + imageId; //imageId has leading @ sign } return rtnURL; }; //............................................ init_() local // init_ - This function creates and intializes the panel var init_ = function () { if (jPanel != undefined) jPanel.remove(); jPanel = $('<div id=' + us.idMITESTPANEL + ' class=' + us.clsPANEL + ' title="uScope Multi-Image Test Panel"></div>'); var template = '<br>' + '&nbsp;&nbsp;&nbsp;&nbsp;<Input type = radio Name = \"SELECTED\" class =\"' + us.clsMITESTSEL + '\" Value = \"SELIDX\">' // selected image radio btn + '&nbsp;&nbsp;&nbsp;&nbsp;<input class = \"' + us.clsMITESTPIN + '\" type=\"checkbox\" name=\"IMAGEID\" value=\"NUM\"/> TEXT' // pinned status + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<Input type = radio Name = \"GROUP\" class =\"' + us.clsMITESTTYPE + '\" Value = "patient" checked>' //radios for sample types + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<Input type = radio Name = \"GROUP\" class =\"' + us.clsMITESTTYPE + '\" Value = "positive">'// + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<Input type = radio Name = \"GROUP\" class =\"' + us.clsMITESTTYPE + '\" Value = "negative">'; var jDstThumbnails = $(".dst_image-thumbnail"); // scrape the urls of the dst thumbnails in the DST! nImages = jDstThumbnails.length; if (nImages == 0) { genericMessage("No DST Thumbnails found"); return; } // if no images in the tray (or the tray isn't there) get out var listStr = '<div>&nbsp;&nbsp;SEL&nbsp;&nbsp; PIN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Patient&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +&nbsp;&nbsp;&nbsp;&nbsp; -'; for (var t = 0; t < nImages; t++) { var src = jDstThumbnails[t].src; var idx = src.lastIndexOf("@"); var idx1 = src.indexOf("?", idx); var imageId = src.slice(idx, idx1); imageIdList[t] = { imageId: imageId, isOpen: false, isPinned: false }; // fill handy list of available imageId's listStr += template.replace(/SELIDX/g, t).replace(/IMAGEID/g, imageId).replace("NUM", t).replace("TEXT", imageId).replace(/GROUP/g, t); } listStr += '</div>'; listStr += '<br><div><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button class=\"' + us.clsPREFBUTTON + '\" id=\"' + us.idINVERTCONTROLBTN + '\" type="button">Swap Controls</button></span></div>' listStr += "<br><br><div>Notes: <br>o You can also use uScope's next/previous buttons to replace the currently selected image.</div>"; var jList = $(listStr); // create the tab jq object jPanel.append(jList); // add the tabs to the panel $(us.idHashROOT).append(jPanel); // first must add the panel to the root to be able to move it $("#" + us.idMITESTPANEL).dialog({ autoOpen: true, closeOnEscape: true, draggable: true, stack: true, resizable: false , width: 220, position: [200, 'top'], dialogClass: "dialogMover" , close: function (event, ui) { $(this).remove(); } , buttons: [{ text: "OK", click: function () { $(this).remove(); } }] }); // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idMITESTPANEL).parent().appendTo(us.idHashROOT); jSelected = jPanel.find("." + us.clsMITESTSEL); // jPinned = jPanel.find("." + us.clsMITESTPIN); jSampleTypes = jPanel.find("." + us.clsMITESTTYPE); var openImageList = uScope.getStateArray(); // set initial state of selected image radio button for (var i = 0; i < openImageList.length; i++) { var imageId = openImageList[i].imagePath; consoleWrite("openImageList imageId: " + imageId); for (var t = 0; t < nImages; t++) { if (imageIdList[t].imageId == imageId) { selImageIdx = t; jSelected[t].checked = true; imageIdList[t].isOpen = true; break; } } } bindEvents_(); // add event handlers }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // MAIN TOOLBAR OBJECT // // The "main" toolbar contains the feature access buttons and settings. It is positioned below // the selected image's toolbar. function cToolbar() { var self = this; // local var for closure var jtoolbar; //............................................ enableToolbarIcons() public // enableToolbarIcons - This function [en|dis]ables all buttons on the top toolbar. this.enableToolbarIcons = function (bEnable) { var state = bEnable ? "enabled" : "disabled"; setIconState($("#" + us.idTBRESIZE), us.idTBRESIZE, state); setIconState($("#" + us.TBSETTINGS), us.TBSETTINGS, state); setIconState($("#" + us.TBISCOPE), us.TBISCOPE, state); //todo: need disabled state for multiview, also since enabled has 3 options need 3 disabled and special handler! /// setIconState($("#" + us.idTBMULTIVIEW), us.idTBMULTIVIEW, state); //todo: snapshot setIconState($("#" + us.TBPDNOPEN), us.TBPDNOPEN, state); setIconState($("#" + us.TBANNOTPANEL), us.TBANNOTPANEL, state); setIconState($("#" + us.TBRASTEROPEN), us.TBRASTEROPEN, state); setIconState($("#" + us.TBCONFCREATE), us.TBCONFCREATE, state); //todo: add pi panel...TBPLUGINPANEL if (us.DBGTOOLBAR) consoleWrite("cToolbar: enableToolbarIcons: -" + state); }; //............................................ position() public // position - This function positions the main toolbar on the selected image. this.position = function (crOffset) { //debug-only if (crOffset) consoleWrite("cToobar: position: " + crOffset.toString()); if (crOffset == undefined) jtoolbar.css({ "left": "2px", "top": "2px" }); else jtoolbar.css({ "left": crOffset.x + "px", "top": (crOffset.y + crOffset.h) + "px" }); }; //............................................ bindEvents_() local // bindEvents_ - This function adds the autopan event handlers. // // Note that an exception is made here and the namespace is not an image's namespace. var bindEvents_ = function () { var namespace = ".autopan"; if (us.ENABLEAUTOPAN == true) { $(us.idHashROOT).on('click' + namespace, "#" + us.idTOPTOOLBARV, function (e) { if (uScope.isThisImageValid() == false) return false; var thisImg = uScope.getThisImage(); thisImg.autoPan.onOffToggle(); return false; }); } $(us.idHashROOT).on('click' + namespace, "." + us.idTBRESIZE + "-e", function (e) { triggerUScopeEvent(us.evRESIZECLICK, {}); return false; }); if (BrowserDetect.isIOS()) { $(us.idHashROOT).on('touchstart' + namespace, "." + us.idTBRESIZE + "-e", function (e) { triggerUScopeEvent(us.evRESIZECLICK, {}); return false; }); } if (uScope.toolbarCanAddButton("dscSetupBtn")) { // conferencing button $(us.idHashROOT).on('click' + namespace, "." + us.TBCONFCREATE + "-e", function (e) { // if development mode of conferencing and not already in a conference if (us.ENABLECONFDEVMODE && uScope.isModeConference() == false) { cConfTestPanel(); } else if (uScope.isModeConference() == false) {// else execute operational conferencing uScope.confCreate(); } return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.TBCONFCREATE + "-a", function (e) { return false; //prevent autopan action }); // $(us.idHashROOT).on('click' + namespace, "#" + us.idTBCONFJOIN, function (e) { // vilDUMMY_JoinConf(); // use dummied in VIL call to join a conference // return false; // }); // $(us.idHashROOT).on('click' + namespace, "#" + us.idTBCONFCLOSE, function (e) { // vilDUMMY_ExitConf(); // use dummied in VIL call to close a conference // return false; // }); // $(us.idHashROOT).on('click' + namespace, "#" + us.idTBCONFLEAD, function (e) { // vilDUMMY_LeadConf(); // use dummied in VIL call to change conference leadership // return false; // }); } //conf //debug-only test event ----------------------------------- if (us.ENABLETBTESTICON == true) { $(us.idHashROOT).on('click' + namespace, "#" + us.idTBCONFCLOSE, function (e) { var buildFULLURL_ = function (imageId) {//imageId has leading @ sign var rtnURL; var fullURL = uScope.getFullURL(); //assumes a selected image if (fullURL != undefined) { var idx = fullURL.lastIndexOf("@"); if (idx > 0) rtnURL = fullURL.substr(0, idx) + imageId; //imageId has leading @ sign } return rtnURL; }; var addImage = function (id, sampleType) { var imageSet = { "images": [{ "imagePath": id, "fullURL": buildFULLURL_(id), "mag": "Fit", "sampleType": sampleType}] }; uScope.imageUpdate("add", imageSet.images); }; var replaceImage = function (idOld, idNew, sampleType) { var imageSetOld = { "images": [{ "imagePath": idOld}] }; var imageSetNew = { "images": [{ "imagePath": idNew, "fullURL": buildFULLURL_(idNew), "mag": "Fit", "sampleType": sampleType}] }; uScope.imageUpdate("replace", imageSetOld.images, imageSetNew.images); }; var changeImageState = function (id, sampleType) { var imageSet = { "images": [{ "imagePath": id, "sampleType": sampleType}] }; uScope.imageUpdate("state", imageSet.images); }; addImage("@10", "patient"); // add image @10 replaceImage("@10", "@2", "patient"); // replace @10 with @2 changeImageState("@2", "positive"); // change @2 to a positive addImage("@55", "patient"); // add @55 return false; }); } //debug-only test event ----------------------------------- $(us.idHashROOT).on('click' + namespace, "." + us.idTBMULTIVIEW + "-4" // multi image arrangement button + ",." + us.idTBMULTIVIEW + "-v" + ",." + us.idTBMULTIVIEW + "-h", function (e) { if (uScope.getImageCount() > 1) uScope.imageArrange(true); return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.idTBMULTIVIEW + "-d", function (e) { if (us.ControlKeyDown == true && us.ShiftKeyDown == true) // this is a debug/development thing cMultiImageTestPanel(); return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.TBSNAPSHOT + "-e", function (e) {// snapshot button //todo: if user pref is save report region, else if save region, else if save view, else if save link to view if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); var anObj = thisImg.getAnnotObj(); var regionId = anObj.getReportRegionId(); if (regionId > 0) { triggerUScopeEvent(us.evSNAPSHOT, { imageId: thisImg.getImageId(), regionId: regionId }); } else { thisImg.log("Report region does not exist. Please create a report region first."); genericMessage("Report region does not exist.<br /> Please create a report region first.", "Snapshot of report region") } } return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.TBISCOPE + "-e", function (e) {// open in imagescope button var thisImg = uScope.getThisImage(); triggerUScopeEvent(us.evIMAGESCOPEOPEN, { imageId: thisImg.getImageId() }); return false; }); if (us.ENABLEANNOTREAD == true) { // pin drop nav button $(us.idHashROOT).on('click' + namespace, "." + us.TBPDNOPEN + "-e", function (e) { if (uScope.isThisImageValid()) { triggerUScopeEvent(us.evPDNAVCLICK, {}); //note-until there is a way to know that the pin drop nave tool closes, don't change its state } return false; }); } //annnot read }; //............................................ init_() local // init_ = This function creates the toolbar, sizes it and adds its event handlers. var init_ = function () { jtoolbar = $(us.idHashROOT).find('#' + us.idTOPTOOLBARV); // if the toolbar already exists, remove it if (jtoolbar.length) jtoolbar.remove(); jtoolbar = $("<div/>", { // build the toolbar div tag "id": us.idTOPTOOLBARV, "class": us.clsSUPEROVERLAY + " " + us.clsTRANSPARENT, "title": "Click to AutoPan Up, Click Again to Stop AutoPan" }); var clsTBSPACER = us.clsTBSPACER_H; // horizontal toolbar spacer if (us.SHOWALLTOOLBARICONS || uScope.toolbarCanAddButton("resizeBtn")) // if there's intent to show the button jtoolbar.append($("<a/>", { "id": us.idTBRESIZE, "class": us.clsTBBUTTON + " " + us.idTBRESIZE + "-e", "title": "Resize the image viewer" })); if (us.SHOWALLTOOLBARICONS || uScope.toolbarCanAddButton("openImageScopeBtn")) // if there's intent to show the button jtoolbar.append($("<a/>", { "id": us.TBISCOPE, "class": us.clsTBBUTTON + " " + us.TBISCOPE + "-e", "title": "Open this image in ImageScope" })); // multi-image arangement jtoolbar.append($("<a/>", { "id": us.idTBMULTIVIEW, "class": us.clsTBBUTTON + " " + us.idTBMULTIVIEW + "-4", "title": "Change image tiling pattern" })); if (us.SHOWALLTOOLBARICONS || uScope.toolbarCanAddButton("snapshotBtn")) // if there's intent to show the button jtoolbar.append($("<a/>", { "id": us.TBSNAPSHOT, "class": us.clsTBBUTTON + " " + us.TBSNAPSHOT + "-e", "title": "Snapshot of report region" })); if (us.SHOWALLTOOLBARICONS || us.ENABLEANNOTREAD && !BrowserDetect.isIOS()) { // annotations buttons if (us.SHOWALLTOOLBARICONS || uScope.toolbarCanAddButton("openPDNBtn")) // if there's intent to show the button jtoolbar.append($("<a/>", { "id": us.TBPDNOPEN, "class": us.clsTBBUTTON + " " + us.TBPDNOPEN + "-e", "title": "Open the pin drop navigation tool" })); jtoolbar.append($("<a/>", { "id": us.TBANNOTPANEL, "class": us.clsTBBUTTON + " " + us.TBANNOTPANEL + "-e", "title": "Open the annotation toolbox" })); } if (us.SHOWALLTOOLBARICONS || (us.ENABLERASTERSCAN == true && uScope.toolbarCanAddButton("autoRaster"))) // if there's intent to show the rasterScan button jtoolbar.append($("<a/>", { "id": us.TBRASTEROPEN, "class": us.clsTBBUTTON + " " + us.TBRASTEROPEN + "-e", "title": "Open the raster scan tool" })); if ( (BrowserDetect.isIOS() == false && uScope.toolbarCanAddButton("dscSetupBtn")) || (us.SHOWALLTOOLBARICONS || us.ENABLECONFDEVMODE) ) {// conferencing button jtoolbar.append($("<a/>", { "id": us.TBCONFCREATE, "class": us.clsTBBUTTON + " " + us.TBCONFCREATE + "-e", "title": "Create a conference" })); // if (us.ENABLECONFDEVMODE && uScope.isModeDev()) { // development mode conference functionality // jtoolbar.append($("<div/>", { "class": clsTBSPACER + " " + us.clsTBBUTTON })); // jtoolbar.append($("<a/>", { "id": us.idTBCONFJOIN, "class": us.clsTBBUTTON, "title": "Join the conference" })); // jtoolbar.append($("<a/>", { "id": us.idTBCONFLEAD, "class": us.clsTBBUTTON, "title": "Change conference leader" })); // jtoolbar.append($("<a/>", { "id": us.idTBCONFCLOSE, "class": us.clsTBBUTTON, "title": "Exit the conference" })); // jtoolbar.append($("<div/>", { "class": clsTBSPACER + " " + us.clsTBBUTTON })); // } } if (us.ENABLEPLUGINS) {// plugin buttons jtoolbar.append($("<a/>", { "id": us.TBPLUGINPANEL, "class": us.clsTBBUTTON + " " + us.TBPLUGINPANEL + "-e", "title": "Open the plug in panel" })); jtoolbar.append($("<div/>", { "class": clsTBSPACER + " " + us.clsTBBUTTON })); } jtoolbar.append($("<a/>", { "id": us.TBSETTINGS, "class": us.clsTBBUTTON + " " + us.TBSETTINGS + "-e", "title": "Open the settings panel" })); //debug-only handy to add a test event if (us.ENABLETBTESTICON == true) jtoolbar.append($("<a/>", { "id": us.idTBCONFCLOSE, "class": us.clsTBBUTTON, "title": "Exit the conference" })); //debug-only handy to add a test event $(us.idHashROOT).append(jtoolbar); // append the toolbar to the root node self.position(); bindEvents_(); }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // IMAGE TITLE TOOLBAR OBJECT // // Each image has an associated toolbar in its top left corner containing: // Active Buttons // - a close button // - possibly the previous and next slide buttons // Indicators // - an icon indicating the sample is a positive or negative control, if applicable // - an icon indicating the image is pinned, if applicable // function cImageToolbar(vpObj) { var self = this; // local var for closure var thisImg = vpObj; // the viewport object - the parent var isLoaded = false; // image tooblar has been loaded var jVpDiv = thisImg.vpDivGet("outer"); // for quick access var jToolbar; var jToolbarStateDiv; var spacerWidth_; var jCloseIcon; var jPinnedIcon; var jControlIcon; var jPrevSlideIcon; var jNextSlideIcon; //............................................ pinnedSet() public this.isPinnedSet = function () { //thisImg.log("isPinnedSet: isPinned: " + thisImg.isPinned() + " sampleTypeIsControl:" + thisImg.sampleTypeIsControl()); if (thisImg.sampleTypeIsControl() == false) { // no need to show pinned when is a control sample if (thisImg.isPinned()) jPinnedIcon.show(); else jPinnedIcon.hide(); showStateDiv_(); // show/hide the state indicator div } else { jPinnedIcon.hide(); } }; //............................................ sampleTypeSet() public // This function hides or (shows and sets) the sample type icon this.sampleTypeSet = function () { if (thisImg.sampleTypeIsControl() == false) { jControlIcon.hide(); } else { jControlIcon.removeClass(us.clsTBCONTROL + "-p").removeClass(us.clsTBCONTROL + "-n"); jControlIcon.addClass(getControlClass_()); jControlIcon.attr("title", getControlTip_()); jControlIcon.show(); } nextPrevSlideSet_(); // show/hide the next slide, previous slide buttons showStateDiv_(); // show/hide the state indicator div }; //............................................ nextPrevSlideSet() public // This function shows/disables/hides the next slide and previous slide buttons var nextPrevSlideSet_ = function () { if (thisImg.sampleTypeIsControl() == true // control slides don't show prev/next slide on the image's toolbar || thisImg.isPinned() == true // pinned slides don't either || uScope.toolbarCanAddButton("nextPrevSlide") == false) { jPrevSlideIcon.hide(); jNextSlideIcon.hide(); } else { if (uScope.isConfMember() == true) { // disable the buttons if in conference as follower setIconState($("." + us.clsTBPREVSLIDE), us.clsTBPREVSLIDE, "disabled"); setIconState($("." + us.clsTBNEXTSLIDE), us.clsTBNEXTSLIDE, "disabled"); } else { // enable and show the buttons setIconState($("." + us.clsTBPREVSLIDE), us.clsTBPREVSLIDE, "enabled"); setIconState($("." + us.clsTBNEXTSLIDE), us.clsTBNEXTSLIDE, "enabled"); jPrevSlideIcon.show(); jNextSlideIcon.show(); } } }; //............................................ getOffsetRect() public this.getOffsetRect = function () { var pos = jToolbar.offset(); var rect = uScope.rootRectGet(); var rtnOffset = new cRect(pos.left - rect.x, pos.top-rect.y, jToolbar.width(), jToolbar.height()); //debug-only thisImg.log("imageToolbar: rootRect: " + rect.toString()); //debug-only thisImg.log("imageToolbar: getOffsetRect: " + pos.left + "," + pos.top + " root left: " + rect.x + " offset rect: " + rtnOffset.toString()); return rtnOffset; }; //............................................ showStateDiv_() local // If only the spacer bar is displayed on the state indicator div, hide the div var showStateDiv_ = function () { if (jToolbarStateDiv.width() > spacerWidth_) jToolbarStateDiv.show(); else jToolbarStateDiv.hide(); }; //............................................ getControlClass_() local var getControlClass_ = function () { var ext = "-o"; var type = thisImg.sampleTypeGet(); if (type == 'positive') ext = "-p"; else if (type == 'negative') ext = "-n"; return us.clsTBCONTROL + ext; }; //............................................ getControlTip_() local var getControlTip_ = function () { var type = thisImg.sampleTypeGet(); if (type == 'positive') return "Image is a Positive Control"; else if (type == 'negative') return "Image is a Negative Control"; return ""; }; //............................................ bindEvents_() local // bindEvents_ - This function adds the image toolbar event handlers. // // Note that by using the same namespace as the viewport when the // viewport removes its events by namespace, these are also removed. var bindEvents_ = function () { var namespace = thisImg.eventNameSpaceGet(); jCloseIcon.on("click" + namespace, function (e) { if (uScope.getImageCount() > 1) { // insure at least one image is open var imageId = thisImg.getImageId(); triggerUScopeEvent(us.evIMAGECLOSE, { imageId: imageId }); } return false; }); // note: use of jPrevSlideIcon and jNextSlideIcon here also responded to the -d disabled state ///PR BUG!!!!!!!!!!!!////////////////////////////////////////// jVpDiv.on('click' + namespace, "." + us.clsTBNEXTSLIDE + "-e", function (e) { //$(us.idHashROOT).on('click' + namespace, "." + us.clsTBNEXTSLIDE + "-e", function (e) { triggerUScopeEvent(us.evOPENNEXTSLIDE, {}); return false; }); jVpDiv.on('click' + namespace, "." + us.clsTBPREVSLIDE + "-e", function (e) { //$(us.idHashROOT).on('click' + namespace, "." + us.clsTBPREVSLIDE + "-e", function (e) { triggerUScopeEvent(us.evOPENPREVSLIDE, {}); return false; }); ////////////////////////////////////////// $(us.idHashROOT).on(us.evIMAGEUPDATE, function (e, parms) { // set close button icon to enabled if > 1 image open setIconState(jCloseIcon, us.clsTBCLOSEIMAGE, ((uScope.getImageCount() == 1) ? "disabled" : "enabled")); nextPrevSlideSet_(); // disable the next/prev slide buttons if in conference as a member }); }; //............................................ init_() local // init_ = This function creates the toolbar, sizes it and adds its event handlers. var init_ = function () { jToolbar = $("<div/>", { "class": us.clsIMAGETOOLBAR + " " + us.clsTRANSPARENT }); //todo: decide about an image title // var title = thisImg.getTitle(); // if (title && title.length > 0) jToolbar.text(title); // action buttons ..................................... jToolbar.append($("<a/>", { "class": us.clsTBCLOSEIMAGE + ((uScope.getImageCount() == 1) ? "-d" : "-e") // set close button icon to enabled if > 1 image open + " " + us.clsTBCLOSEIMAGE + " " + us.clsIMAGETOOLBARBTN, "title": "Close this image"})); // because slide state can change from patient to a control in which case the next/prev slide button is hidden, // always load the buttons and hide them if the slide is a control via nextPrevSlideSet_() jToolbar.append($("<a/>", { "class": us.clsTBPREVSLIDE + " " + us.clsTBPREVSLIDE + "-e" + " " + us.clsIMAGETOOLBARBTN, "title": "Open the previous slide in the tray (keyboard: q, Q)" })); jToolbar.append($("<a/>", { "class": us.clsTBNEXTSLIDE + " " + us.clsTBNEXTSLIDE + "-e" + " " + us.clsIMAGETOOLBARBTN, "title": "Open the next slide in the tray (keyboard: e, E)" })); //status indicators ..................................... jVpDiv.append(jToolbar); // place the toolbar div in the vp jToolbar.append($("<div/>", { "class": us.clsIMAGETOOLBARSTATE })); jToolbarStateDiv = jToolbar.find("." + us.clsIMAGETOOLBARSTATE); jToolbarStateDiv.append($("<div/>", { "class": us.clsIMAGETOOLBARSPC + " " + us.clsIMAGETOOLBARBTN })); spacerWidth_ = jToolbarStateDiv.width(); //save jToolbarStateDiv.append($("<a/>", { "class": us.clsTBPINNED + " " + us.clsIMAGETOOLBARBTN, "title": "Status: Image is Pinned Open" })); jToolbarStateDiv.append($("<a/>", { "class": us.clsTBCONTROL + " " + getControlClass_() + " " + us.clsIMAGETOOLBARBTN, "title": "Status: Image is a Positive Control" })); jCloseIcon = jToolbar.find("." + us.clsTBCLOSEIMAGE); jPrevSlideIcon = jToolbar.find("." + us.clsTBPREVSLIDE + "-e"); jNextSlideIcon = jToolbar.find("." + us.clsTBNEXTSLIDE + "-e"); jPinnedIcon = jToolbarStateDiv.find("." + us.clsTBPINNED); jControlIcon = jToolbarStateDiv.find("." + us.clsTBCONTROL); self.sampleTypeSet(); // update the status of sampleType self.isPinnedSet(); // update the status of pinned bindEvents_(); // add event handlers isLoaded = true; }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- function cVisibilityPanel() { var self = this; // local var for closure var jPanel; // for quick access var jParent; var jVizAllCheckBox; // the "check all" checkbox var jVizCheckBoxes; // array of all viz check boxes var settingsPanel = new cSettingsPanel(); //............................................ check() public // This function shows/hides the specified overlay // using the visibility checkboxes which updates the user preferences. this.check = function (clsOverlay, bCheck) { var isVisible = isOverlayVisible_(clsOverlay); if (bCheck == isVisible) // if the checkbox is already in the desired state, return return; for (var b = 0, len = jVizCheckBoxes.length; b < len; b++) { if (clsOverlay == jVizCheckBoxes[b].name) { jVizCheckBoxes[b].click(); // set the visibility check box to the desired checked state break; } } }; //............................................ show_() local // This function shows/hides the visibility panel var show_ = function (show) { if (show == true) { jPanel.dialog("open"); // position the fly out panel var rootPos = $(us.idHashROOT).offset(); // root div position relative to the document var thisImg = uScope.getThisImage(); if (thisImg) { var crOffset = thisImg.toolbar.getOffsetRect(); jParent.offset({ "left": rootPos.left + crOffset.x, "top": rootPos.top + crOffset.y }); } else { jParent.offset({ "left": rootPos.left + 2, "top": rootPos.top + 2 }); } for (var b = 0, len = jVizCheckBoxes.length; b < len; b++) { // set the visibility check boxes checked state var isVisible = isOverlayVisible_(jVizCheckBoxes[b].name); jVizCheckBoxes[b].checked = isVisible; //debug-only consoleWrite(b + " " + clsOverlay + " " + isVisible); } jVizAllCheckBox[0].checked = areAllVisible_(); // set the "all checked" check box } else { jPanel.dialog("close"); } }; //............................................ isOverlayVisible_() local var isOverlayVisible_ = function (clsOverlay) { var rtnVisible = false; if (clsOverlay == us.clsDIVGUAGES) // because the tilemeter auto-hides, get its current preference rtnVisible = uScope.prefGet(us.clsDIVGUAGES); else if (clsOverlay == us.CVSHEATMAP) rtnVisible = uScope.prefGet(us.CVSHEATMAP); else rtnVisible = $("." + clsOverlay).is(':visible'); return rtnVisible; }; //............................................ countOverlayVisible() local var countOverlayVisible_ = function () { var vizCount = 0; // count of the number of overlays visible for (var b = 0, len = jVizCheckBoxes.length; b < len; b++) { // set the visibility check boxes checked state var isVisible = isOverlayVisible_(jVizCheckBoxes[b].name); if (isVisible == true) vizCount++; } return vizCount; }; //............................................ areAllVisible_() local var areAllVisible_ = function () { return (countOverlayVisible_() == jVizCheckBoxes.length); }; //............................................ bindEvents_() local // bindEvents_ - This function adds the configuration panel event handlers. // // Note that an exception is made here and the namespace is not an image's namespace. var bindEvents_ = function () { var namespace = ".toolbar"; //............................................ visibility panel open/close var settingsTimerRemove_ = function () { var timer = $("." + us.TBSETTINGS + "-e").data("hover"); if (timer) { clearTimeout(timer); // stop the timer $("." + us.TBSETTINGS + "-e").data("hover", null); // remove timer } }; $(us.idHashROOT).on('mouseleave' + namespace, '#' + us.idCONFIGPANEL, function () {// close the panel when mouse moves off of the panel show_(false); // hide the viz panel setIconState($("#" + us.TBSETTINGS), us.TBSETTINGS, "enabled"); settingsTimerRemove_(); // remove the timer return false; }); // hover over settings icon activates the viz panel $("." + us.TBSETTINGS + "-e").hover( function () { // handler in var timer = $(this).data("hover"); // show the panel when the mouse hovers over the toolbar icon if (!timer) { // if no timer set, set one timer = setTimeout(function () { // set timer that will fire the hover action after 2 seconds show_(true); // show the viz panel setIconState($('#' + us.TBSETTINGS), us.TBSETTINGS, "active"); $(this).data("hover", null); }, 300); // delay time in milli-sec $(this).data("hover", timer); // save timer } } , function () { settingsTimerRemove_(); } // handler out ); // although hover is going to activate the viz panel, if ever the button is just exposed, handle it $(us.idHashROOT).on('click' + namespace, "." + us.TBSETTINGS + "-e", function (e) {// show_(true); // show the viz panel setIconState($('#' + us.TBSETTINGS), us.TBSETTINGS, "active"); return false; // prevents autopan from activating }); $(us.idHashROOT).on('click' + namespace, "." + us.TBSETTINGS + "-a", function (e) {// show_(hide); // hide the viz panel setIconState($('#' + us.TBSETTINGS), us.TBSETTINGS, "enabled"); return false; }); $(us.idHashROOT).on('click' + namespace, "#" + us.idOPTIONSBTN, function (e) {// open options panel settingsPanel.show(true); }); $(us.idHashROOT).on('click' + namespace, "#" + us.idVIZALLCHECKBOX, function (e) {// // the checked state into this fn is the changed state // consoleWrite("cVisibilityPanel: all: " + this.name + " value: " + this.value + " checked: " + this.checked); if (areAllVisible_() == true) { // if all visible now, hide all for (var b = 0, len = jVizCheckBoxes.length; b < len; b++) { jVizCheckBoxes[b].click(); } } else { // for (var b = 0, len = jVizCheckBoxes.length; b < len; b++) { var isVisible = isOverlayVisible_(jVizCheckBoxes[b].name); if (isVisible == false) jVizCheckBoxes[b].click(); } } }); jPanel.on('change' + namespace, '.' + us.clsVIZCHECKBOX, function (e) { //debug-only consoleWrite("cVisibilityPanel: change: name: " + this.name + " value: " + this.value + " checked: " + this.checked); uScope.prefSet(this.name, this.checked); // setting pref triggers evUSERPREFSET jVizAllCheckBox[0].checked = areAllVisible_(); // set the "all checked" check box uScope.overlayRefresh(); // arrange all overlays of all views uScope.setImageSelected(uScope.getImageSelectedIndex(), true); // now force selection to hide overlays on non-selected images }); $(us.idHashROOT).on('click' + namespace, "#" + us.idHMCLEARBTN, function (e) {// thumbnail heat map clear triggerUScopeEvent(us.evHEATMAPCLEAR, {}); }); }; //............................................ init_() local var init_ = function () { jPanel = $('<div id=' + us.idCONFIGPANEL + ' class=' + us.clsPANEL + ' ' + us.clsPANELCLICKCLOSE + '></div>'); $(us.idHashROOT).append(jPanel); // first must add the panel to the root to be able to move it $("#" + us.idCONFIGPANEL).dialog({ autoOpen: false, title: "Visibility", closeOnEscape: true, draggable: false, stack: true, resizable: false , width: 160 , mouseleave: function (event, ui) { show_(false); setIconState($("#" + us.TBSETTINGS), us.TBSETTINGS, "enabled"); } }); // append this dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idCONFIGPANEL).parent().appendTo(us.idHashROOT); var horizLine = "<br><div class='tooldivider'></div><br>"; // horizontal line var html = "<div><h4>&nbsp;&nbsp;Visibility&nbsp;&nbsp;</h4><div><div class='tooldivider'></div>"; // use a template and replace scheme to build the visibility check box list var checkboxes = '<div>'; checkboxes += '<br><input id = \"' + us.idVIZALLCHECKBOX + '\" type=\"checkbox\" title=\"Select All\" name=\"ALLOVERLAYS\" value=\"All\"/> All'; var template = '<br><input class = \"' + us.clsVIZCHECKBOX + '\" type=\"checkbox\" title=\"TIP\" name=\"OVERLAYCLASS\" value=\"OVERLAYCLASS\"/> TEXT'; if (uScope.canViewLabel()) checkboxes += template.replace("TIP", "Image Label").replace(/OVERLAYCLASS/g, us.clsDIVLABEL).replace("NUM", 0).replace("TEXT", "Label"); if (us.ENABLEMAG == true) checkboxes += template.replace("TIP", "Magnifier Glass").replace(/OVERLAYCLASS/g, us.clsDIVMAG).replace("NUM", 1).replace("TEXT", "Magnifier Glass"); if (us.ENABLEROTATION == true) checkboxes += template.replace("TIP", "Rotation Dial").replace(/OVERLAYCLASS/g, us.clsROTATIONDIV).replace("NUM", 2).replace("TEXT", "Rotation Dial"); if (us.ENABLESCALEBAR == true) checkboxes += template.replace("TIP", "Scale Bar").replace(/OVERLAYCLASS/g, us.clsDIVSCALEBAR).replace("NUM", 3).replace("TEXT", "Scale Bar"); if (us.ENABLETILEMETER) checkboxes += template.replace("TIP", " Tile Meter").replace(/OVERLAYCLASS/g, us.clsDIVGUAGES).replace("NUM", 4).replace("TEXT", " Tile Meter"); if (us.ENABLETHUMB == true) checkboxes += template.replace("TIP", "Thumbnail").replace(/OVERLAYCLASS/g, us.clsDIVTHUMBNAIL).replace("NUM", 5).replace("TEXT", "Thumbnail"); if (us.ENABLEHEATMAP == true) { checkboxes += template.replace("TIP", "Heat Map").replace(/OVERLAYCLASS/g, us.CVSHEATMAP).replace("NUM", 6).replace("TEXT", "Heat Map"); var heatmapClearBtn = '&nbsp;&nbsp;&nbsp;&nbsp;<span><button class=\"' + 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' + '\" Title= "Clear the thumbnail heat map" id=\"' + us.idHMCLEARBTN + '\" type="button" style="margin: 0px;">&nbsp;Clear&nbsp;</button></span>'; checkboxes += heatmapClearBtn; } if (us.ENABLEZOOMCTL == true) { checkboxes += template.replace("TIP", "Zoom Control").replace(/OVERLAYCLASS/g, us.clsDIVZOOMCTL).replace("NUM", 7).replace("TEXT", "Zoom Control"); checkboxes += template.replace("TIP", "Zoom Slider").replace(/OVERLAYCLASS/g, us.clsDIVZOOMSLIDER).replace("NUM", 8).replace("TEXT", "Zoom Slider"); } html += checkboxes + '<div>'; var horizLine = "<br><div class='tooldivider'></div><br>"; // horizontal line var settingsPanelBtn = '&nbsp;&nbsp;&nbsp;&nbsp;<span><button class=\"' + 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' + '\" Title= "Configuration options" id=\"' + us.idOPTIONSBTN + '\" type="button" style="margin: 0px;">&nbsp;&nbsp;Options&nbsp;&nbsp;</button></span>'; html += horizLine + settingsPanelBtn; $("#" + us.idCONFIGPANEL).html(html); jPanel.siblings('div.ui-dialog-titlebar').remove(); // hide the title bar jPanel.siblings('.ui-dialog-titlebar-close').hide(); // hide close button jVizCheckBoxes = jPanel.find('.' + us.clsVIZCHECKBOX); // get for quick reference jVizAllCheckBox = jPanel.find('#' + us.idVIZALLCHECKBOX); jParent = jPanel.parent(); bindEvents_(); // add event handlers }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- function cSettingsPanel() { var self = this; // local var for closure var jPanel; // for quick access var advancedPanel; //............................................ setSliderQuality() local // setSliderQuality - This function sets the image quality on the preferences tab. this.setSliderQuality = function (quality) { var jHandle = $("#" + us.idPREFQUALITYSLIDER).find(".ui-slider-handle"); jHandle.text(quality); }; //............................................ show() public this.show = function (show) { if (show == false) { jPanel.dialog("close"); return; } jPanel.dialog("open"); // .............................................................report tab // insure that the current prefs are displayed $("#" + us.idREPORTFIXEDWIDTH).val(String(uScope.prefGet("reportRegionWidth", us.eReportSpec.defWidthPx))); $("#" + us.idREPORTFIXEDHEIGHT).val(String(uScope.prefGet("reportRegionHeight", us.eReportSpec.defHeightPx))); var reportType = +uScope.prefGet("reportRegionType", 0); $("." + us.clsREPORTTYPE)[reportType].checked = "checked"; // check current report type // .............................................................image info tab var link = ""; $("#" + us.idLINKTEXTBOX).html(link); var imageInfo = _getImageInformation(); //todo: add _getImageLink and refactor this $("#" + us.idTABIMAGEINFO).html(imageInfo); // .............................................................preferences tab if (us.ENABLETHUMBHOVER == true) { var checked = uScope.prefGet(us.clsDIVTHUMBHOVER); $("#" + us.idTHHOVERCHECKBOX).prop('checked', checked); // check thumbnail enlarge on hover checkbox } // us.viewPrefs = { // "quality": 75, // "defQuality": 75 // }; //// uScope.prefSet("imageQuality", us.viewPrefs.quality); //// temp do not show image quality slider //// $("#" + us.idPREFQUALITYSLIDER).slider({ // slider event handler //// value: us.viewPrefs.quality, //// step: 5, min: 45, max: 105, // the slide fn gets range 50 to 100 with these settings //// slide: function (event, ui) { //// us.viewPrefs.quality = $(this).slider("value"); //// $(ui.handle).text(us.viewPrefs.quality); //// } //// , stop: function (event, ui) { // on stop save quality as a preference //// uScope.prefSet("imageQuality", us.viewPrefs.quality); //// } //// }); //// self.setSliderQuality(uScope.prefGet("imageQuality")); // set the image quality on the slider handle }; //............................................ _getImageInformation() local var _getImageInformation = function () { var imageInfo = "No Image Selected"; if (uScope.isThisImageValid() == true) { var thisImg = uScope.getThisImage(); var xinfo = thisImg.getXinfoObj(); //todo- use accessors provided by viewport!!!! imageInfo = "Scanner: " + thisImg.getScanner() + "<br>File: " + thisImg.getFileName() + "<br>Image ID: " + thisImg.getImageId() + "<br>Image Type: " + us.captureNames[thisImg.getCaptureType()]; if (xinfo.isFused) { for (var i = 0; i < xinfo.fusedFiles.length; i++) imageInfo += "<br>&nbsp;&nbsp; Member File: " + xinfo.fusedFiles[i]; } imageInfo += "<br><br>Image dimensions (pixels): " + thisImg.getImageDims().toString2() + "<br>Tile dimensions (pixels): " + thisImg.getXinfoObj().tileWidth + " x " + thisImg.getXinfoObj().tileHeight + "<br>Image Resolution (microns/pixel) : " + thisImg.getBaseMPP() + "<br>Image Depth : " + xinfo.depth + "<br>Image Channels: " + ((xinfo.isFused) ? xinfo.fusedFiles.length : xinfo.samplPerPix) + "<br>Image Bit Depth: " + xinfo.bitsPerSampl; if (xinfo.acqBitsPerSampl) imageInfo += "<br>Acquisition Bit Depth: " + xinfo.acqBitsPerSampl; //cp-is there value in the AIL description? // var fullDesc = thisImg.getImageDescription(); // if (fullDesc && fullDesc.indexOf("Aperio Image Library") != -1) { // Aperio Image Library v12.0.8 // var idx = fullDesc.indexOf("v"); // var idx2 = fullDesc.indexOf(" ", idx) // var vers = fullDesc.slice(idx,idx2); // imageInfo += "<br><br>Library: Aperio Image Library " + vers; // } if (thisImg.getFileTypeDesc()) imageInfo += "<br><br>File/Compression Type: " + thisImg.getFileTypeDesc(); if (thisImg.getCompQuality()) imageInfo += "<br>Compression Quality: " + thisImg.getCompQuality(); if (thisImg.getImageICCProfile()) imageInfo += "<br>ICC Profile: " + thisImg.getImageICCProfile(); if (thisImg.getScanScopeId()) imageInfo += "<br>Scanner: " + thisImg.getScanScopeId(); if (thisImg.getImageDate()) imageInfo += "&nbsp;&nbsp;Date: " + thisImg.getImageDate(); if (us.ENABLELINKTOIMAGE == true) { // link to this image // format example: http: //localhost/view.html?fullURL=//aperio-00824:82/@@bYOUR_TOKEN_HERE==/@5&x=9360&y=9371&mag=20 // http: //localhost/view.html?fullURL=/imageserver/@@bYOUR_TOKEN_HERE==/@2 var sImgSrc = thisImg.getFullURL() ? thisImg.getFullURL() : (thisImg.getServer() + thisImg.getImageId()); var linkValue = "http://" + window.location.hostname + "/view.html?fullURL=" + sImgSrc + "&x=" + thisImg.getViewCenterX() + "&y=" + thisImg.getViewCenterY() + "&mag=" + thisImg.getViewMag(); //debug-onlyconsoleWrite("link: " + linkValue); var imageLink = '<br>' + '<div class=\"' + us.clsSETCHOICE + '\" ui-state-default ui-corner-all"><img id=\"us_imglink\" alt=""/>Link to this image</div>' + '<div id=\"' + us.idLINKTEXTBOX + '\" title="Copy this link into your browser.">' + linkValue + '</div>'; imageInfo += imageLink; } } return imageInfo; }; //............................................ bindEvents_() local // bindEvents_ - This function adds the settings panel event handlers. var bindEvents_ = function () { // user preference update $(us.idHashROOT).on(us.evUSERPREFDEFAULTREPORT + ".report", function (e, parms) { //consoleWrite("report us.evUSERPREFDEFAULTREPORT recvd"); uScope.prefSet("reportRegionWidth", us.eReportSpec.defWidthPx); uScope.prefSet("reportRegionHeight", us.eReportSpec.defHeightPx); uScope.prefSet("reportRegionType", us.eReportSpec.defReportType); // update the panel $("#" + us.idREPORTFIXEDWIDTH).val(String(uScope.prefGet("reportRegionWidth", us.eReportSpec.defWidthPx))); $("#" + us.idREPORTFIXEDHEIGHT).val(String(uScope.prefGet("reportRegionHeight", us.eReportSpec.defHeightPx))); var reportType = +uScope.prefGet("reportRegionType"); $("." + us.clsREPORTTYPE)[reportType].checked = "checked"; }); //............................................ settings panel, advanced $(us.idHashROOT).on('click', "#" + us.idPREFADVANCEDBTN, function () { if (uScope.canAccessProtSettings() == true) { advancedPanel.show(true); } else { var cb_unlockAdv = function (input) { if (input == uScope.getProgDate()) { uScope.setAccessProtSettings(true); advancedPanel.show(true); } else consoleWrite("cb_unlockAdv called: " + input + " does not match"); } genericInput("Please enter your access code: ", "Protected Page", cb_unlockAdv); } }); //............................................ settings panel, pref buttons $(us.idHashROOT).on('click', "#" + us.idTHHOVERCHECKBOX, function (e) {// change thumbnail hover pref // the checked state into this fn is the changed state //consoleWrite("Hover check box : checked: " + this.checked); uScope.prefSet(us.clsDIVTHUMBHOVER, this.checked); }); $(us.idHashROOT).on('click', "." + us.clsPREFBUTTON, function (e) { var target = e.currentTarget.id; //if (us.DBGOPTIONS) consoleWrite("save user preferences: " + target); if (target === us.idPREFLABELROTBTN) { var thisImg = uScope.getThisImage(); //multi-image - note that all images must be updated here if (thisImg) uScope.prefSet("labelRotation", thisImg.label.getViewAngle()); } else if (target == us.idPREFDEFAULTBTN) { // default pref tab triggerUScopeEvent(us.evUSERPREFDEFAULTLABELROT, { status: true }); // fire event to default label rotation triggerUScopeEvent(us.evUSERPREFDEFAULTTHUMBHOVER, { status: true }); // fire event to default thumbnail hover enlargement } else if (target == us.idRPTDEFAULTBTN) { // default report tab if (us.DBGTOOLBAR) consoleWrite("report default click"); triggerUScopeEvent(us.evUSERPREFDEFAULTREPORT, { status: true }); //fire event } else if (target == us.idPTESTREPORTBTN) { // performance test report if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); var svObj = thisImg.stateVector; var report = svObj.reportAll(us.eStateTypes.view, true); if (report.length > 0) { var report2 = report.replace(/\r\n|\n\r|\r|\n/g, "<br>"); genericMessage(report2, "Current Sequence"); } consoleWrite(report); } } else if (target == us.idPTESTRUNBTN) { // performance test run if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); if (thisImg.getPerfTestObj().isRunning() == false) { // not running, start it var idxTest = $("." + us.clsPERFTESTOPTION).filter(':checked').val(); var useRecorded = ($("." + us.clsPERFTESTINTERVAL).filter(':checked').val() == "0") ? true : false; var interval = $("#" + us.idPERFTESTINTERVAL).val(); // get the interval to run with var running = thisImg.getPerfTestObj().run(+idxTest, useRecorded, +interval); $("#" + us.idPTESTRUNBTN).text("Stop"); } else { // already running, stop it thisImg.getPerfTestObj().stop(); $("#" + us.idPTESTRUNBTN).text("Run"); } } } else if (target == us.idPTESTSHOWBTN) { // performance test save results if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); var report = thisImg.getPerfTestObj().getTestReport(); if (report.length > 0) { var report2 = report.replace(/\r\n|\n\r|\r|\n/g, "<br>"); genericMessage(report2, "Test Results"); } consoleWrite(report); } } }); /////todo: jq version seems to have elminated ui.panel.id so I have to figure out how to do this $(us.idHashROOT).on('click', "#" + us.idSETTINGSTABS, function (e, ui) { //debug-only consoleWrite("tabsselect: " + ui.panel.id); // if (ui.panel.id == us.idTABPERFTEST) { // $("#" + us.idTABPERFTEST).hide(); // if (uScope.canAccessProtSettings() == true) { // $("#" + us.idTABPERFTEST).show(); // } // else { // var cb_unlockMe = function (input) { // if (input == uScope.getProgDate()) { // uScope.setAccessProtSettings(true); // $("#" + us.idTABPERFTEST).show(); // } // else consoleWrite("cb_unlockMe called: " + input + " does not match"); // } // genericInput("Please enter your access code: ", "Protected Page", cb_unlockMe); // } // } if (e.target.hash == "#" + us.idTABABOUT) { uScope.splash(); } }); //............................................ settings panel, report tab $(us.idHashROOT).on('change', "#" + us.idREPORTFIXEDWIDTH + ",#" + us.idREPORTFIXEDHEIGHT, function (e) { var target = e.currentTarget.id; var value = +($("#" + target).val()); //if (us.DBGTOOLBAR) consoleWrite("report region size change:" + target + " val=" + value); // if the value is out of bounds, revert to the prior value and inform the user if (value < us.eReportSpec.minDimPx || value > us.eReportSpec.maxDimPx) { if (target == us.idREPORTFIXEDWIDTH) { $("#" + target).val(String(uScope.prefGet("reportRegionWidth", us.eReportSpec.defWidthPx))); var dim = "width"; } else { $("#" + target).val(String(uScope.prefGet("reportRegionHeight", us.eReportSpec.defHeightPx))); var dim = "height"; } var msg = "The fixed report region " + dim + " must be between " + us.eReportSpec.minDimPx + " and " + us.eReportSpec.maxDimPx + " pixels."; genericMessage(msg, "Value Out of Bounds"); } else { // otherwise keep the change and update the prefs if (target == us.idREPORTFIXEDWIDTH) uScope.prefSet("reportRegionWidth", value); else uScope.prefSet("reportRegionHeight", value); } }); $(us.idHashROOT).on('click', "." + us.clsREPORTTYPE, function (e) { var target = e.currentTarget; var value = $(target).val(); //if (us.DBGTOOLBAR) consoleWrite("report type click: " + value); uScope.prefSet("reportRegionType", value); }); }; //............................................ init_() local // init_ - This function creates and intializes the settings panel. var init_ = function () { if (advancedPanel != undefined) advancedPanel = undefined; advancedPanel = new cAdvancedPanel(); if (jPanel != undefined) jPanel.remove(); jPanel = $("<div/>", { "id": us.idSETTINGSPANEL, "class": us.clsPANEL + ' ' + us.clsPANELCLICKCLOSE, "title": "Options" }); var reportTab = initReportTab_(); var prefsTab = initPrefsTab_(); var imageinfoTab = '<div id=' + us.idIMAGEINFODIV + '>' + '</div>'; var hotkeysTab = initHotKeysTab_(); var aboutTab = uScope.getProgName() + "&nbsp;&nbsp;&nbsp;&nbsp;Version: " + uScope.getProgVersion() + "<br/>" + uScope.getProgDate(); var perftestTab = initPerformanceTab_(); var tabStr = // make tabs and their panel '<div id=' + us.idSETTINGSTABS + '>' + '<ul>' tabStr += '<li><a href="\#' + us.idTABHOTKEYS + '\">Keyboard Shortcuts</a></li>' + '<li><a href="\#' + us.idTABPREFERENCES + '\">Preferences</a></li>' + '<li><a href="\#' + us.idTABREPORT + '\">Report</a></li>' + '<li><a href="\#' + us.idTABIMAGEINFO + '\">Image</a></li>' + '<li><a href="\#' + us.idTABABOUT + '\">About</a></li>'; if (us.ENABLEPERFTEST == true) tabStr += '<li><a href="\#' + us.idTABPERFTEST + '\">Performance</a></li>'; tabStr += '</ul>'; tabStr += '<div id=' + us.idTABHOTKEYS + '>' + hotkeysTab + '</div>' + '<div id=' + us.idTABPREFERENCES + '>' + prefsTab + '</div>' + '<div id=' + us.idTABREPORT + '>' + reportTab + '</div>' + '<div id=' + us.idTABIMAGEINFO + '>' + imageinfoTab + '</div>' + '<div id=' + us.idTABABOUT + '>' + aboutTab + '</div>'; if (us.ENABLEPERFTEST == true) tabStr += '<div id=' + us.idTABPERFTEST + '>' + perftestTab + '</div>'; tabStr += '</div>'; var jTabs = $(tabStr); // create the tab jq object jPanel.append(jTabs); // add the tabs to the panel $(us.idHashROOT).append(jPanel); // first must add the panel to the root to be able to move it $("#" + us.idSETTINGSPANEL).dialog({ // call to create the dialog autoOpen: false, modal: false, draggable: true, stack: true, resizable: false , width: 'auto' // was 424; default to auto so tabs don't wrap , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { setIconState($("#" + us.TBSETTINGS), us.TBSETTINGS, "enabled"); } }); $("#" + us.idSETTINGSTABS).tabs(); // call to create the tabs $("#us_reportradio").buttonset(); ///todo: this isn't doing anything, right? // // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idSETTINGSPANEL).parent().appendTo(us.idHashROOT); bindEvents_(); // add event handlers }; //............................................ initPrefsTab_() local var initPrefsTab_ = function () { //todo: option for magnifier diameter //todo: option for jpeg tile quality //todo: option for autopan speed var labelTTip = "Apply the current label rotation to all images when opened"; var imgQualtyTTip = "Set the download image quality. Default is " + "75."; var advancedTTip = "Open advanced settings panel."; var defaultTTip = "Reset above preferences to defaults."; var space = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; var prefs = '<div><span class=\"' + us.clsSETCHOICE + '\" title=\"' + labelTTip + '\">Label Rotation<button class=\"' // label rotation pref + us.clsPREFBUTTON + '\" id=\"' + us.idPREFLABELROTBTN + '\" type="button">Use Current</button></span></div>'; if (us.ENABLETHUMBHOVER == true) { prefs += '<br><span>Thumbnail Enlarge on Hover&nbsp;&nbsp;&nbsp;&nbsp;</span>' // thumbnail hover pref prefs += '<input id = \"' + us.idTHHOVERCHECKBOX + '\" type=\"checkbox\" name=\"us.idTHHOVERCHECKBOX\" value=\"us.idTHHOVERCHECKBOX\"/><br>'; } //temp hide image quality pref - when reinstated, remove blank-24 // + '<div class=\"' + us.clsSETCHOICE + '\" title=\"' + imgQualtyTTip + '\">' + '<img src="../images/blank-24.png" alt=""/>ImageQuality' // + '<div id=\"' + us.idPREFQUALITYSLIDER + '\" title=\"' + imgQualtyTTip + '\"></div></div>' prefs += '<br><br><div><span class=\"' + us.clsSETCHOICE + '\" title=\"' + defaultTTip + '\">' + space + '<button class=\"' // default prefs + us.clsPREFBUTTON + '\" id=\"' + us.idPREFDEFAULTBTN + '\" type="button">Default</button></span></div>'; prefs += "<br><br><div class='tooldivider'></div>"; // horizontal line prefs += '<br><div><span class=\"' + us.clsSETCHOICE + '\" title=\"' + advancedTTip + '\">' + space + '<button class=\"' // advanced button + us.clsPREFBUTTON + '\" id=\"' + us.idPREFADVANCEDBTN + '\" type="button">Advanced</button></span></div>'; prefs += '<br>'; return prefs; }; //............................................ initReportTab_() local var initReportTab_ = function () { var defaultTTip = "Reset above preferences to defaults."; var report = '<div id=\"' + us.idREPORTFIXEDDIV + '\">' + '<div>&nbsp;&nbsp;&nbsp;<b>Fixed Region Size</b> (in pixels)</div>' + '<br>&nbsp;&nbsp;' + '<span>Width&nbsp;&nbsp;</span><input id=\"' + us.idREPORTFIXEDWIDTH + '\" type="text" value=' + String(uScope.prefGet("reportRegionWidth", us.eReportSpec.defWidthPx)) + '></input>' + '&nbsp;&nbsp;&nbsp;&nbsp;' + '<span>Height&nbsp;&nbsp;</span><input id=\"' + us.idREPORTFIXEDHEIGHT + '\" type="text" value=' + String(uScope.prefGet("reportRegionHeight", us.eReportSpec.defHeightPx)) + '></input>' + '<br></div>' + '<br><Input type = radio Name = rptType class =\"' + us.clsREPORTTYPE + '\" Value = "0" checked> Full Resolution Image,&nbsp; Fixed Sized Report Region' + '<br><Input type = radio Name = rptType class =\"' + us.clsREPORTTYPE + '\" Value = "1"> Full Resolution Image,&nbsp; User Drawn Report Region' + '<br><Input type = radio Name = rptType class =\"' + us.clsREPORTTYPE + '\" Value = "2"> Current Image Resolution,&nbsp; Fixed Sized Report Region' + '<br><Input type = radio Name = rptType class =\"' + us.clsREPORTTYPE + '\" Value = "3"> Current Image Resolution,&nbsp; User Drawn Report Region' + '<br><br>' + '<div class=\"' + us.clsSETCHOICE + '\"><span><button class=\"' + us.clsPREFBUTTON + '\" Title=\"' + defaultTTip + '\" id=\"' + us.idRPTDEFAULTBTN + '\" type="button">Default</button></span><br></div>' + '<br>'; return report; }; //............................................ initPerformanceTab_() local var initPerformanceTab_ = function () { var perftest; if (us.ENABLEPERFTEST == true) { //// var reportSeqTTip = "Report the current navigation sequence"; //// var runTTip = "Execute the selected performance test"; //// var showTTip = "Display the test results"; //// var spacing = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; //// var nameList = thisImg.getPerfTestObj().getTestNames(); perftest = "&nbsp;&nbsp;<span><b>Test Sequence</b></span>"; //////////////////////////////////////////////////////////////////////////////////// //note: remove blank-24 btn like prefs tab did when this is brought back on line //////////////////////////////////////////////////////////////////////////////////// //// for (var n = 0; n < nameList.length; n++) { //// if (n == nameList.length - 1) //// var atest = '<br>' + spacing + '<Input type = radio Name = perfTest class =\"' + us.clsPERFTESTOPTION + '\" Value = \"' + n + '\" checked>&nbsp; ' + nameList[n]; //// else //// var atest = '<br>' + spacing + '<Input type = radio Name = perfTest class =\"' + us.clsPERFTESTOPTION + '\" Value = \"' + n + '\">&nbsp; ' + nameList[n]; //// perftest += atest; //// } //// perftest += '<br><br>'; //// perftest += "&nbsp;&nbsp;<span><b>Test Interval</b></span>"; //// perftest += '<br>' + spacing + '<Input type = radio Name = perfInterval class =\"' + us.clsPERFTESTINTERVAL + '\" Value = "0"> Recorded Interval' //// + '<br>' + spacing + '<Input type = radio Name = perfInterval class =\"' + us.clsPERFTESTINTERVAL + '\" Value = "1" checked> Specified Interval'; //// perftest += '&nbsp;&nbsp;<span>(msec)&nbsp;&nbsp;</span><input id=\"' + us.idPERFTESTINTERVAL + '\" type="text" value=' + 3000 + '></input>'; //// perftest += '<br>'; //// perftest += '<div class=\"' + us.clsSETCHOICE + '\" title=\"' + runTTip + '\"><img src="../images/blank-24.png" alt=""/>Selected Test<span><button class=\"' //// + us.clsPREFBUTTON + '\" id=\"' + us.idPTESTRUNBTN + '\" type="button"><b>Run</b></button></span></div>'; //// perftest += '<div class=\"' + us.clsSETCHOICE + '\" title=\"' + showTTip + '\"><img src="../images/blank-24.png" alt=""/>Test Results<span><button class=\"' //// + us.clsPREFBUTTON + '\" id=\"' + us.idPTESTSHOWBTN + '\" type="button">Display</button></span></div>'; //// perftest += '&nbsp;&nbsp;&nbsp;&nbsp;<div class=\"tooldivider\"></div>'; //// perftest += '<div class=\"' + us.clsSETCHOICE + '\" title=\"' + reportSeqTTip + '\"><img src="../images/blank-24.png" alt=""/>Current Sequence<span><button class=\"' //// + us.clsPREFBUTTON + '\" id=\"' + us.idPTESTREPORTBTN + '\" type="button">Report</button></span></div>' } return perftest; }; //............................................ initHotKeysTab_() local var initHotKeysTab_ = function () { // arrow key navigation: Move the image in view up,down,left,right 1/4 of the view width,height. // If the shift key is down, Move the image in view up,down, // left,right 3/4 of the view width,height. // control - navigation: zoom out // control + navigation: zoom in // // delete: delete selected annotation // r: rotate cw +15 degrees // shift r: rotate cw +1 degrees // control r: rotate ccw +15 degrees // control shift r: rotate ccw +1 degrees // 0, num0: set rotation to 0 degrees var hotkeys = '<div id=\"' + us.idTABHOTKEYS + '\">' + '<table><tbody>' + '<tr><td><h4>Slide Change</h4></td></tr> ' + '<tr><td>q, Q</button></td><td>Step to the previous slide in the tray</td></tr>' + '<tr><td>e, E</button></td><td>Step to the next slide in the tray</td></tr>' + '<tr><td>&nbsp;</td></tr>' + '<tr><td><h4>View Navigation</h4></td></tr> ' + '<tr><td>Arrow Keys</td><td>Move the view 1/4 of the view width,height</td></tr>' + '<tr><td>Shift + Arrow Keys</td><td>Move the view 3/4 of the view width,height</td></tr>' + '<tr><td>&nbsp;</td></tr>' + '<tr><td><h4>View Magnification</h4></td></tr>' + '<tr><td>Control -</td><td>Zoom Out</td></tr>' + '<tr><td>Control +</td><td>Zoom In</td></tr>' + '<tr><td>Double-Click</td><td>Toogle between the last two magnfications</td></tr>' + '<tr><td>&nbsp;</td></tr>' + '<tr><td><h4>View Rotation</h4></td></tr> ' + '<tr><td>r</td><td>Rotate CW +15 degrees</td></tr>' + '<tr><td>Shift R</td><td>Rotate CW +1 degrees</td></tr>' + '<tr><td>Control r</td><td>Rotate CCW +15 degrees</td></tr>' + '<tr><td>Control Shift R</td><td>Rotate CCW +1 degrees</td></tr>' + '<tr><td>0 (zero)</td><td>Set rotation to 0 degrees</td></tr>' + '<tr><td>&nbsp;</td></tr>' + '<tr><td><h4>Annotations</h4></td></tr> ' + '<tr><td>Delete</td><td>Delete selected annotation</td></tr>' + '</tbody></table>' + '</div><br>'; return hotkeys; }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // ADVANCED PANEL OBJECT //------------------------------------------------------------------------------------------------- function cAdvancedPanel() { var self = this; // local var for closure var cacheStatTimer_; var jPanel; // for quick access var consolePanel; //............................................ show() public this.show = function (show) { if (show == true) { if (uScope.isThisImageValid() == false) return; jPanel.dialog("open"); cacheDisplayStart(); } else { jPanel.dialog("close"); ///clearInterval(cacheStatTimer_); cacheDisplayStop_(); } }; //............................................ cacheDisplayStart() local // cacheDisplayStart - This function ..... var cacheDisplayStart = function () { if (cacheStatTimer_ > -1) return; if (uScope.isThisImageValid() == false) return; var thisImg = uScope.getThisImage(); var cacheStr = thisImg.getCacheObj().getStatsStr(); $('#us_cachetextbox').html(cacheStr); if (us.ENABLECACHE == true) // if the cache is enabled, start the interval timer that displays its stats cacheStatTimer_ = setInterval(cacheStatsUpdate_, 1000); }; var cacheDisplayStop_ = function () { clearInterval(cacheStatTimer_); cacheStatTimer_ = -1; }; //............................................ cacheStatsUpdate_() local // cacheStatsUpdate_ - This function updates the cache statistics on the advanced panel. var cacheStatsUpdate_ = function () { var cacheStr = uScope.getThisImage().getCacheObj().getStatsStr(); $('#us_cachetextbox').html(cacheStr); }; //............................................ bindEvents_() local // bindEvents_ - This function adds the advanced panel event handlers. // // Note that an exception is made here and the namespace is not an image's namespace. var bindEvents_ = function () { var namespace = ".advpanel"; $(us.idHashROOT).on('click' + namespace, "#" + us.idADVCACHEENABLE, function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); var sCacheIsOn = (us.ENABLECACHE == false) ? "Stop" : "Start"; // if the cache is disabled and the browser default is disabled, allow the user to cancel if (us.ENABLECACHE == false && uScope.isBrowserAllowed("cache") == false) genericMessage("Image tile caching has been specifically turned off for this browser.<br /> Proceed with caution.", "Warning!"); us.ENABLECACHE = !us.ENABLECACHE; // toggle the cache enable $('#' + us.idADVCACHEENABLE).html(sCacheIsOn); if (us.ENABLECACHE == true) { thisImg.vpStartCacheCare(); // start the cache maintenance thread cacheDisplayStart(); } else { thisImg.vpStopCacheCare(); // stop the cache maintenance thread cacheDisplayStop_(); } } if (us.DBGCACHE) consoleWrite("cache is:" + ((us.ENABLECACHE == false) ? "disabled" : " enabled")); }); $(us.idHashROOT).on('click' + namespace, "#" + us.idADVCACHEPURGE, function (e) { if (uScope.isThisImageValid()) { uScope.getThisImage().getCacheObj().purge(); cacheStatsUpdate_(); } }); $(us.idHashROOT).on('click' + namespace, "#" + us.idADVTOGGLEPF, function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); var sPrefetchIsOn = (us.ENABLEPREFETCH == false) ? "Stop" : "Start"; // if prefetch is disabled and the browser default is disabled, allow the user to cancel if (us.ENABLEPREFETCH == false && uScope.isBrowserAllowed("prefetch") == false) genericMessage("Image tile prefetching has been specifically turned off for this browser.<br /> Proceed with caution.", "Warning!"); var newState = !us.ENABLEPREFETCH; // toggle the prefetch enable if (newState == true) { // if pf is to start/resume if (thisImg.pfInitialized == false) // and if pf is not yet initialized thisImg.vpPrefetchStart(); // then start it else thisImg.vpPrefetchResume(); // or if already initialzed, resume $('#' + us.idADVTOGGLEPF).html("Stop"); } else { // if pf is to stop thisImg.vpPrefetchSuspend(); // then suspend $('#' + us.idADVTOGGLEPF).html("Start"); } us.ENABLEPREFETCH = newState; // save the new pf state - must do after calling pf functions if (us.DBGPREFETCH) consoleWrite("prefetch is:" + ((us.ENABLEPREFETCH == false) ? "disabled" : " enabled")); } }); $(us.idHashROOT).on('click' + namespace, "#" + us.idADVCONSOLE, function (e) { if ($("#" + us.idDBGCONSOLE).is(':visible') == false) consolePanel.show(true); }); }; //............................................ init_() local // init_ - This function creates and intializes the advanced panel. var init_ = function () { if (consolePanel != undefined) consolePanel = undefined; consolePanel = new cConsolePanel(); if (jPanel != undefined) jPanel.remove(); jPanel = $("<div/>", { "id": us.idADVANCEDPANEL, "class": us.clsPANEL, "title": "Advanced Settings" }); var sCacheIsOn = (us.ENABLECACHE == false) ? "Start" : "Stop"; var sPrefetchIsOn = (us.ENABLEPREFETCH == false) ? "Start" : "Stop"; var cacheStr = "xxxx"; var adv = '<br>' + '<div>Cache<button title="Turn image tile storage on/off." class=\"' + us.clsADVBUTTON1 + '\" id=\"' + us.idADVCACHEENABLE + '\" type="button">' + sCacheIsOn + '</button>' + '<span><button title="Purge the image tile storage." class=\"' + us.clsADVBUTTON2 + '\" id=\"' + us.idADVCACHEPURGE + '\" type="button">Empty</button></span>' + '</div>' + '<br>' + '<div id=\"' + "us_cachetextbox" + '\" title="">' + cacheStr + '</div>' ///+ "<br><div class='tooldivider'></div><br>" // horizontal line + "<br><div class='tooldivider'></div>" // horizontal line + '<div>PreFetch<button title="Turn image tile prefetch on/off." class=\"' + us.clsADVBUTTON1 + '\" id=\"' + us.idADVTOGGLEPF + '\" type="button">' + sPrefetchIsOn + '</button></div>' ///+ "<br><div class='tooldivider'></div><br>" // horizontal line + "<br>" + '<div>Console<button title="View the console reports." class=\"' + us.clsADVBUTTON1 + '\" id=\"' + us.idADVCONSOLE + '\" type="button">Show</button>' + '</div>'; jPanel.append(adv); $(us.idHashROOT).append(jPanel); // add the panel to the root $(jPanel).dialog({ autoOpen: false, modal: false, draggable: true, stack: true, closeOnEscape: false , resizable: false, width: 350, height: 350 , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { cacheDisplayStop_(); } , buttons: [{ text: "OK", click: function () { $(this).dialog("close"); } }] }); // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idADVANCEDPANEL).parent().appendTo(us.idHashROOT); bindEvents_(); }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // RASTER SCAN PANEL //------------------------------------------------------------------------------------------------- function cRasterPanel() { //todo: when a setting is changed it must be changed for ALL multi-images var self = this; // local var for closure var jPanel; // for quick access var jProgressBar; //............................................ close() public // This function closes the raster panel; this.close = function () { jPanel.dialog("close"); }; //............................................ start() public // This function clicks the raster panel start button which // sets the panel state and calls the rasterScan object's start() this.start = function () { $("." + us.RPSTART).click(); }; //............................................ pause() public // This function clicks the raster panel pause button which // sets the panel state and calls the rasterScan object's stop() this.pause = function () { $("." + us.RPPAUSE).click(); }; //............................................ configure() public // This function ... this.configure = function () {//todo:rename to textSet??? if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); if (thisImg && thisImg.rasterScan) { //thisImg.log("Raster Scan configure"); var rasterObj = thisImg.rasterScan; var rasterMag = rasterObj.parmAction("get", us.eRASTERPARMS.MAG); var rasterMode = rasterObj.parmAction("get", us.eRASTERPARMS.MODE); var info = rasterMode + " Scan at " + rasterMag + "X"; $("#" + us.idRPTEXT).text(info); var instr = (rasterMode == "Manual") ? "SpaceBar Steps the View" : "SpaceBar to Pause/Resume"; $("#" + us.idRPINSTR).text(instr); // set the checked state of the sequence style var segValue = rasterObj.parmAction("get", us.eRASTERPARMS.SEQUENCESTYLE); var btnSel = $("." + us.clsSEQUENCESTYLE)[segValue]; btnSel.children[0].checked = true; // check current raster scan segmentation type $(btnSel).addClass(us.clsRSSTYLESEL); // add selected state to this button ////// test to hide the seg style stuff // var jBar = $("#" + us.RPRASTERBAR); // consoleWrite(jBar.position().left + "," + jBar.position().top + " width: " + jBar.height()); // var jpanel = $('#' + us.idRASTERPANEL); // jpanel.height(80 ); } } }; //............................................ show() local var show = function (show) { //uScope.getThisImage().log("Raster Scan show: "+ show); if (show == true) { jPanel.dialog("open"); self.configure(); } else { jPanel.dialog("close"); } }; //............................................ isOpen() public this.isOpen = function () { return (jPanel && jPanel.hasClass('ui-dialog-content') && jPanel.dialog("isOpen")) ? true : false; }; //............................................ settingsAdv_() local var settingsAdv_ = function () { if ($(us.idHashROOT).find("#" + us.idRASTERSETADV).length > 0) return; // already open, then return if (uScope.isThisImageValid() == false) return false; var thisImg = uScope.getThisImage(); // there must be a valid image var rasterObj = thisImg.rasterScan; var jSettingsAdv = $("<div/>", { "id": us.idRASTERSETADV, "class": us.clsPANEL + ' ' + us.clsPANELCLICKCLOSE, "title": "Advanced Raster Settings" }); //................................................. // raster view overlap selection jSettingsAdv.append($("<div/>", { "class": 'tooldivider', css: { "visibility": 'hidden'} })); var strSelect = '<select id = "' + us.idRPOVERLAP + '" class = "' + us.clsSELECTBOX + '" style="width: 110px" title="Select raster view overlap">'; for (var m = 10; m < 100; m += 10) strSelect += '<option value="' + m + '">&nbsp;' + m + '%</option>'; strSelect += '</select>'; var jOverlap = $(strSelect); jOverlap.change(function () { var value = parseInt(jOverlap[0][jOverlap[0].selectedIndex].value); rasterObj.parmAction("set", us.eRASTERPARMS.OVERLAPPCT, value); }); jOverlap.set = function () { var overlapSelected = rasterObj.parmAction("get", us.eRASTERPARMS.OVERLAPPCT); for (var o = 0; o < jOverlap[0].length; o++) { if (jOverlap[0][o].value == overlapSelected) { jOverlap[0].selectedIndex = o; break; } } }; jOverlap.set(); jSettingsAdv.append(jOverlap); jSettingsAdv.append($('<span>&nbsp;View Overlap</span>')); //................................................. // raster pattern selection jSettingsAdv.append($("<div/>", { "class": 'tooldivider', css: { "visibility": 'hidden'} })); var strSelect = '<select id = "' + us.idRPPATTERN + '" class = "' + us.clsSELECTBOX + '" style="width: 110px" title="Select raster pattern">'; var list = rasterObj.parmAction("get", us.eRASTERPARMS.PATTERNLIST); for (var m = 0; m < list.length; m++) strSelect += '<option value="' + list[m].name + '">&nbsp;' + list[m].name + '</option>'; strSelect += '</select>'; var jPattern = $(strSelect); jPattern.change(function () { var idx = jPattern[0].selectedIndex; var value = jPattern[0][idx].value; rasterObj.parmAction("set", us.eRASTERPARMS.PATTERNNAME, value); }); jPattern.set = function () { var patternSelected = rasterObj.parmAction("get", us.eRASTERPARMS.PATTERNNAME); for (var o = 0; o < jPattern[0].length; o++) { if (jPattern[0][o].value == patternSelected) { jPattern[0].selectedIndex = o; break; } } }; jPattern.set(); jSettingsAdv.append(jPattern); jSettingsAdv.append($('<span>&nbsp;Raster Pattern</span>')); // //................................................. // raster sensitivity selection //NOTE! NO LONGER NEEDED ... holding space in case something else can refactor this code.... also raster object has CONTENTPCT code intact // remove soon ... june 2013 // jSettingsAdv.append($("<div/>", { "class": 'tooldivider', css: { "visibility": 'hidden'} })); // jSettingsAdv.append($("<div/>", { "class": 'tooldivider' })); // jSettingsAdv.append($("<div/>", { "class": 'rph2', "text": "Tissue Segementation", // css: { 'font-weight': 'bold', 'margin': 'margin: 5px 0px 15px 0px;'} // })); // var strSelect = '<select id = "' + us.idRPSENSITIVITY + '" class = "' + us.clsSELECTBOX + '" style="width: 110px" title="Select view content sensitivity">'; // strSelect += '<option value="' + 3 + '">&nbsp;' + 3 + '%</option>'; // for (var m = 5; m < 55; m += 5) // strSelect += '<option value="' + m + '">&nbsp;' + m + '%</option>'; // strSelect += '</select>'; // var jContentPct = $(strSelect); // jContentPct.change(function () { // var idx = jContentPct[0].selectedIndex; // var value = parseInt(jContentPct[0][idx].value); // rasterObj.parmSet(us.eRASTERPARMS.CONTENTPCT, value); // }); // jContentPct.set = function () { // var contentPct = rasterObj.parmAction("get",us.eRASTERPARMS.CONTENTPCT); // for (var o = 0; o < jContentPct[0].length; o++) { // if (jContentPct[0][o].value == contentPct) { // jContentPct[0].selectedIndex = o; // break; // } // } // }; // jContentPct.set(); // jSettingsAdv.append(jContentPct); // jSettingsAdv.append($('<span>&nbsp;Sensitivity</span>')); //................................................. // raster threshold selection jSettingsAdv.append($("<div/>", { "class": 'tooldivider', css: { "visibility": 'hidden'} })); var strSelect = '<select id = "' + us.idRPTHRESHOLD + '" class = "' + us.clsSELECTBOX + '" style="width: 110px" title="For Bright Field images, choose higher value to include light tissue. For Fluorescence images, choose a lower value to include dark tissue.">'; if (thisImg.getCaptureType() == us.eAICCaptureType.aic_i_FL) for (var m = 5; m < 50; m += 5) { strSelect += '<option value="' + m + '">&nbsp;' + m + '</option>'; } else for (var m = 170; m < 230; m += 10) { strSelect += '<option value="' + m + '">&nbsp;' + m + '</option>'; } strSelect += '</select>'; var jPixelThresh = $(strSelect); jPixelThresh.change(function () { var idx = jPixelThresh[0].selectedIndex var value = parseInt(jPixelThresh[0][idx].value); rasterObj.parmAction("set", us.eRASTERPARMS.PIXELTHRESH, value); }); jPixelThresh.set = function () { var pixelThresh = rasterObj.parmAction("get", us.eRASTERPARMS.PIXELTHRESH); for (var o = 0; o < jPixelThresh[0].length; o++) { if (jPixelThresh[0][o].value == pixelThresh) { jPixelThresh[0].selectedIndex = o; break; } } }; jPixelThresh.set(); jSettingsAdv.append(jPixelThresh); jSettingsAdv.append($('<span>&nbsp;Tissue Threshold</span>')); //................................................. // default button jSettingsAdv.append($("<div/>", { "class": 'tooldivider', css: { "visibility": 'hidden'} })); jSettingsAdv.append($("<button/>", { "id": us.idRPSETTINGSDEF, "class": us.clsRPBUTTON + ' ' + us.clsSETBUTTON, "text": "Default", "title": "Reset above settings to default values" , click: function () { rasterObj.parmAction("default", us.eRASTERPARMS.OVERLAPPCT); jOverlap.set(); rasterObj.parmAction("default", us.eRASTERPARMS.PATTERNNAME); jPattern.set(); ////rasterObj.parmAction("default", us.eRASTERPARMS.CONTENTPCT); ////jContentPct.set(); rasterObj.parmAction("default", us.eRASTERPARMS.PIXELTHRESH); jPixelThresh.set(); } })); //................................................. // position and open the raster advanced settings panel var offsetPos = $('#' + us.idRASTERSETTINGS).offset(); if (offsetPos == null || offsetPos == undefined) offsetPos = { "left": 0, "top": 0 }; $(jSettingsAdv).dialog({ autoOpen: true, position: [offsetPos.left, offsetPos.top], closeOnEscape: true, resizable: false , width: 260, height: 230 , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , open: function (event, ui) { } , close: function (event, ui) { // remove this panel and the raster settings panel $(this).remove(); $('#' + us.idRASTERSETTINGS).remove(); } }); //................................................. // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created jSettingsAdv.parent().appendTo(us.idHashROOT); }; //............................................ settings_() local var settings_ = function () { if ($(us.idHashROOT).find("#" + us.idRASTERSETTINGS).length > 0) return; // already open, then return if (uScope.isThisImageValid() == false) return false; var thisImg = uScope.getThisImage(); // there must be a valid image var rasterObj = thisImg.rasterScan; var jSettings = $("<div/>", { "id": us.idRASTERSETTINGS, "class": us.clsPANEL + ' ' + us.clsPANELCLICKCLOSE, "title": "Raster Settings" }); //................................................. // raster mode selection /// var checked = (rasterObj.parmAction("get",us.eRASTERPARMS.MODE) == "Automatic") ? "checked" : ""; var jMode = $('<input type="checkbox" class = "ui-corner-all" id="' + us.idRASTERMODE + '" /><label for="' + us.idRASTERMODE + '">&nbsp;Auto Scan&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>'); jMode.change(function () { var newMode = rasterObj.parmAction("toggle", us.eRASTERPARMS.MODE); self.configure(); }); jMode.attr('title', 'Manual or Automatic Raster Scanning'); jMode.set = function () { jMode.attr('checked', (rasterObj.parmAction("get", us.eRASTERPARMS.MODE) == "Automatic") ? true : false); }; jMode.set(); // initialize check state jSettings.append(jMode); //................................................. // raster magnification selection var magList = thisImg.getFixedZoomArray(); var magSelected = rasterObj.parmAction("get", us.eRASTERPARMS.MAG); var strSelect = '<select id = "' + us.idRASTERMAG + '" class = "' + us.clsSELECTBOX + '>'; for (var m = 0, len = magList.length; m < len; m++) { var mag = magList[m].mag; if (mag != "Fit" && mag > 1) { //todo: remove the mags that are not reasonable to scan by computing grid or something strSelect += '<option value="' + mag + '">&nbsp;' + mag + 'X</option>'; } } strSelect += '</select>'; var jMagnification = $(strSelect); jMagnification.attr('title', 'Select Raster Scan Magnification'); //add tooltip jMagnification.change(function () { var value = parseInt(jMagnification[0][jMagnification[0].selectedIndex].value); rasterObj.parmAction("set", us.eRASTERPARMS.MAG, value); self.configure(); }); jMagnification.set = function () { var magSelected = rasterObj.parmAction("get", us.eRASTERPARMS.MAG); for (var o = 0; o < jMagnification[0].length; o++) { if (jMagnification[0][o].value == magSelected) { jMagnification[0].selectedIndex = o; break; } } }; jMagnification.set(); jSettings.append(jMagnification); jSettings.append($('<span>Magnfication&nbsp;</span>')); //................................................. // default button jSettings.append($("<div/>", { "class": 'tooldivider', css: { "visibility": 'hidden'} })); jSettings.append($("<button/>", { "id": us.idRPSETTINGSDEF, "class": us.clsRPBUTTON + ' ' + us.clsSETBUTTON, "text": "Default", "title": "Reset above settings to default values" , click: function () { rasterObj.parmAction("default", us.eRASTERPARMS.MODE); jMode.set(); rasterObj.parmAction("default", us.eRASTERPARMS.MAG); jMagnification.set(); self.configure(); //todo: report } })); //................................................. // advanced settings button jSettings.append($("<a/>", { "id": us.RPSETTINGSADV, "class": us.clsRPBUTTON + " " + us.RPSETTINGSADV, "title": "Advanced Settings" , click: function () { settingsAdv_(); } })); //................................................. // position and open the settings panel var offsetPos = $('#' + us.idRASTERPANEL).offset(); if (offsetPos == null || offsetPos == undefined) offsetPos = { "left": 0, "top": 0 }; $(jSettings).dialog({ autoOpen: true, position: [offsetPos.left, offsetPos.top], closeOnEscape: true, resizable: false , width: 260, height: 140 , dialogClass: "dialogMover"// allows the dialog to move outside of its container - very important in HC , open: function (event, ui) { } , close: function (event, ui) { $(this).remove(); // remove this panel and change the icon setIconState($("#" + us.RPSETTINGS), us.RPSETTINGS, "enabled"); } }); //................................................. // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created jSettings.parent().appendTo(us.idHashROOT); }; //............................................ init_() local // init_ - This function creates and intializes the annotations panel var init_ = function () { if (jPanel != undefined) jPanel.remove(); jPanel = $('<div id=' + us.idRASTERPANEL + ' class=' + us.clsPANEL + ' title="Raster"></div>'); jPanel.append($("<a/>", { "id": us.RPSETTINGS, "class": us.clsRPBUTTON + " " + us.RPSETTINGS, "title": "Change Settings" })); jPanel.append($("<div/>", { "id": us.idRPTEXT, "text": " Raster Scan" })); jPanel.append($("<div/>", { "id": us.idRPINSTR, "text": "" })); jPanel.append($("<a/>", { "id": us.RPBACKUP, "class": us.clsRPBUTTON + " " + us.RPBACKUP, "title": "Reset Progress" })); jPanel.append($("<a/>", { "id": us.RPSLOW, "class": us.clsRPBUTTON + " " + us.RPSLOW + "-d", "title": "Slow Down" })); jPanel.append($("<a/>", { "id": us.RPSTART, "class": us.clsRPBUTTON + " " + us.RPSTART, "title": "Start Raster Scan" })); jPanel.append($("<a/>", { "id": us.RPFAST, "class": us.clsRPBUTTON + " " + us.RPFAST + "-d", "title": "Speed Up" })); jPanel.append($("<div/>", { "class": 'tooldivider', css: { "visibility": 'hidden'} })); var jBarDiv = $("<div/>", { "id": us.RPRASTERBAR, "title": "Raster Progress" }); jBarDiv.append($("<div/>")); jPanel.append(jBarDiv); $(jPanel).dialog({ autoOpen: false, closeOnEscape: true, resizable: false, width: 240 , height: "auto", minHeight: 0 , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , open: function (event, ui) { if (uScope.isThisImageValid() == true) { var thisImg = uScope.getThisImage(); if (thisImg.rasterScan != undefined) thisImg.rasterScan.onPanelOpen(); } } , close: function (event, ui) { setIconState($("#" + us.TBRASTEROPEN), us.TBRASTEROPEN, "enabled"); if (uScope.isThisImageValid() == true) { var thisImg = uScope.getThisImage(); if (thisImg.rasterScan != undefined) thisImg.rasterScan.resetHeatMapState(); } if (thisImg.rasterScan.parmAction("get", us.eRASTERPARMS.MODE) == "Manual") { self.pause(); // closing panel in manual mode forces a raster pause } } , focus: function (event, ui) {///requires a click // doing this for debug when open dlg at b4 image open self.configure(); } }); // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idRASTERPANEL).parent().appendTo(us.idHashROOT); jProgressBar = $('#' + us.RPRASTERBAR).find("div"); // add a radio buttonset to select the sequence style - buttonset doesn't work until after the dialog is associated with the panel var str = '<div id=' + us.idRSSTYLEDIV + '>' + '<label id="us_piecescanL" title="Scan each tissue piece" class =\"' + us.clsSEQUENCESTYLE + '\"><input type="radio" id="us_piecescan" name="radio" Value =' + us.eSEQUENCESTYLES.BYTISSUEPIECES + '></label>' + '<label id="us_tissuescanL" title="Scan all tissue area" class =\"' + us.clsSEQUENCESTYLE + '\"><input type="radio" id="us_tissuescan" name="radio" Value =' + us.eSEQUENCESTYLES.ALLTISSUE + '></label>' + '<label id="us_slidescanL" title="Scan whole slide area" class =\"' + us.clsSEQUENCESTYLE + '\"><input type="radio" id="us_slidescan" name="radio" Value =' + us.eSEQUENCESTYLES.WHOLESLIDE + '></label>' + '</div>'; jPanel.append($(str)); $("#" + us.idRSSTYLEDIV).buttonset(); // convert the radio button look to a buttonset self.position(); // position the panel bindEvents_(); // add event handlers self.configure(); // initialize for the current image }; //............................................ bindEvents_() local // bindEvents_ - This function adds the raster scan panel event handlers. // // Note that an exception is made here and the namespace is not an image's namespace. var bindEvents_ = function () { var namespace = ".raster"; $(us.idHashROOT).on('click' + namespace, "." + us.TBRASTEROPEN + "-e", function () { show(true); self.position(); setIconState($("#" + us.TBRASTEROPEN), us.TBRASTEROPEN, "active"); return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.TBRASTEROPEN + "-a", function () { show(false); setIconState($("#" + us.TBRASTEROPEN), us.TBRASTEROPEN, "enabled"); return false; }); // /////////////////////////////////////////////test // $( "#" + us.idRASTERPANEL).hover( // function () { // consoleWrite("hover"); // $('#' + us.idRASTERPANEL).dialog({ dialogClass: "dialogMover" }); // ///$('#' + us.idRASTERPANEL).removeClass('us_transparent'); // return false; } // , function () { // consoleWrite("UN hover"); // $('#' + us.idRASTERPANEL).dialog({ dialogClass: "dialogMover us_transparent" }); // //$('#' + us.idRASTERPANEL).addClass('us_transparent'); // return false; } // ); // /////////////////////////////////////////////test $(us.idHashROOT).on('click' + namespace, "." + us.RPSTART, function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); if (thisImg && thisImg.rasterScan) { $('#' + us.RPSTART).addClass(us.RPPAUSE).removeClass(us.RPSTART); // change start btn to pause $('#' + us.RPSTART).attr("title", "Stop/Pause Raster Scan"); // and update pause tooltop if (thisImg.rasterScan.parmAction("get", us.eRASTERPARMS.MODE) == "Automatic") {// if raster scan mode is automatic, $('#' + us.RPSLOW).addClass(us.RPSLOW).removeClass(us.RPSLOW + "-d"); // enable faster/slower btns $('#' + us.RPFAST).addClass(us.RPFAST).removeClass(us.RPFAST + "-d"); $('#' + us.RPBACKUP).addClass(us.RPBACKUP + "-d").removeClass(us.RPBACKUP); // disable backup during raster } else { $('#' + us.RPBACKUP).addClass(us.RPBACKUP).removeClass(us.RPBACKUP + "-d"); // enable backup during raster mode manual } //todo: how to get the above icons to change right away??? preload images? (tissue segmentation delay is an issue) thisImg.rasterScan.start(); } } }); $(us.idHashROOT).on('click' + namespace, "." + us.RPPAUSE, function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); //debug-only thisImg.log("RPPAUSE CLICK"); $('#' + us.RPSTART).addClass(us.RPSTART).removeClass(us.RPPAUSE); // change pause btn to start $('#' + us.RPSTART).attr("title", "Start/Resume Raster Scan"); // and update start tooltop $('#' + us.RPSLOW).addClass(us.RPSLOW + "-d").removeClass(us.RPSLOW); // disable faster/slower btns $('#' + us.RPFAST).addClass(us.RPFAST + "-d").removeClass(us.RPFAST); $('#' + us.RPBACKUP).addClass(us.RPBACKUP).removeClass(us.RPBACKUP + "-d"); //enable backup during pause thisImg.rasterScan.stop(); } }); $(us.idHashROOT).on('click' + namespace, "." + us.RPBACKUP, function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); thisImg.rasterScan.progressReset("backup"); //todo: it might be better if restart could be signalled differenly and this fn local $('#' + us.RPSTART).attr("title", "Start Raster Scan"); jProgressBar.width("0%"); } }); $(us.idHashROOT).on('click' + namespace, "." + us.RPSLOW, function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); thisImg.rasterScan.parmAction("set", us.eRASTERPARMS.SPEEDFACTOR, "slower"); } }); $(us.idHashROOT).on('click' + namespace, "." + us.RPFAST, function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); thisImg.rasterScan.parmAction("set", us.eRASTERPARMS.SPEEDFACTOR, "faster"); } }); $(us.idHashROOT).on(us.evRASTERPROGRESS + namespace, function (e, parms) { jProgressBar.width(parms.progressPct + "%"); }); $(us.idHashROOT).on('click' + namespace, "." + us.clsSEQUENCESTYLE, function (e) { var input = this.children[0]; // 'this' is the label that encloses the input if (input.checked == true) return; // if already checked, do nothing ( getting 2 clicks for every 1) $(input).checked = true; // because of how the images are on the radio btns, do this myself $("." + us.clsSEQUENCESTYLE).removeClass(us.clsRSSTYLESEL); // remove selected state from other button $(this).addClass(us.clsRSSTYLESEL); // add selected state to this button var value = $(input).val(); // the selected raster sequence style //consoleWrite("sequence style click: " + value); var thisImg = uScope.getThisImage(); if (thisImg && thisImg.rasterScan) // inform the raster object of the selected sequence style thisImg.rasterScan.parmAction("set", us.eRASTERPARMS.SEQUENCESTYLE, +value); }); $(us.idHashROOT).on('click' + namespace, "." + us.RPSETTINGS, function (e) { setIconState($("#" + us.RPSETTINGS), us.RPSETTINGS, "active"); settings_(); }); }; //............................................ position() public // position - This function positions the raster panel to the right of the zoom control. // Note that it assume the zoom control has room to its right ... instead cOverLayout should be updated to handle this. var lastPosition_; this.position = function () { var panelPos; var thisImg = uScope.getThisImage(); var jVpDiv = (thisImg) ? thisImg.vpDivGet("outer") : undefined; var jZoomControl = (jVpDiv) ? jVpDiv.find("." + us.clsDIVZOOMCTL) : undefined; if (uScope.isThisImageValid() == false || jZoomControl == undefined) { var rootPos = $(us.idHashROOT).offset(); panelPos = [rootPos.left, Math.floor(rootPos.top + $(us.idHashROOT).height() / 3)]; } else { var offsetPos = jZoomControl.offset(); // returns 0,0 when zoomcontrol is hidden, e.g. rasterscan mode var zoomWidth = jZoomControl.width(); if (offsetPos == null || offsetPos == undefined) offsetPos = { "left": 0, "top": 0 }; if (offsetPos.left == 0 && offsetPos.top == 0 && lastPosition_ != undefined) panelPos = lastPosition_; else panelPos = [offsetPos.left + zoomWidth + us.kOVERLAY_ELEMENT_SPACE, offsetPos.top]; } lastPosition_ = panelPos; $('#' + us.idRASTERPANEL).dialog({ position: panelPos }); }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // ANNOTATION PANEL //------------------------------------------------------------------------------------------------- function cAnnotPanel() { var self = this; // local var for closure var jPanel; // for quick access var colorPicker; ////////////////////////todo: not this! this.publicColorPicker;//////////////////////// //////////////////////// //............................................ enableDrawingIcons() public // enableDrawingIcons - This function [en|dis]ables all annotation drawing tools // and region specific tools of the annotation panel. this.enableDrawingIcons = function (bEnable) { if (jPanel.is(':visible') == true) { // if the annotations panel is visible var state = bEnable ? "enabled" : "disabled"; setIconState($("#" + us.APANNOTPIN), us.APANNOTPIN, state); setIconState($("#" + us.APANNOTPEN), us.APANNOTPEN, state); setIconState($("#" + us.APANNOTRECT), us.APANNOTRECT, state); setIconState($("#" + us.APANNOTARROW), us.APANNOTARROW, state); setIconState($("#" + us.APANNOTCALIPER), us.APANNOTCALIPER, state); setIconState($("#" + us.APANNOTREPORT), us.APANNOTREPORT, state); setIconState($("#" + us.APANNOTELLIPSE), us.APANNOTELLIPSE, state); setIconState($("#" + us.APANNOTTEXT), us.APANNOTTEXT, state); self.enableRegionIcons(); if (us.DBGANNOTEX) consoleWrite("enableDrawingIcons: -" + state); } }; //............................................ setColorPickerState_() public var setColorPickerState_ = function (anObj, state) { if (isDefined(anObj)) { var layerId = anObj.getSelLayerId(); // double check for R12.0: allow color picking on A-layer and R-layer only var canBeEnabled = anObj.layerIsNamed(layerId, us.AnnotLayerName) || anObj.layerIsNamed(layerId, us.ReportLayerName); if (!canBeEnabled) state = "disabled"; } setIconState($("#" + us.APANNOTCOLOR), us.APANNOTCOLOR, state); }; //............................................ enableRegionIcons() public // enableRegionIcons - This function [en|dis]ables all region specific icons of the annotation panel // including the annotation navigation panel. // Note that the passed annotation object may not be defined (no image open) // and that this function must still set the icon states properly. this.enableRegionIcons = function (anObj) { if (isUnDefined(anObj) && uScope.isThisImageValid()) anObj = uScope.getThisImage().getAnnotObj(); var state = "disabled"; if (isDefined(anObj)) { // if there's an image with an annotation object var region = anObj.getSelectedRegion(); var anType = isDefined(region) ? +region.type : -1; state = (anType < 0) ? "disabled" : "enabled"; // state is enabled if there is a region selected (vs no regions existing) var idOfType; // get the element id of the selected annotation type //cp-!!! change this to a table!! if (anType >= 0) { if (anType === us.eAnTypes.pen) idOfType = us.APANNOTPEN; else if (anType === us.eAnTypes.rect && region.isReportRegion) idOfType = us.APANNOTREPORT; else if (anType === us.eAnTypes.rect) idOfType = us.APANNOTRECT; else if (anType === us.eAnTypes.ellipse) idOfType = us.APANNOTELLIPSE; else if (anType === us.eAnTypes.arrow) idOfType = us.APANNOTARROW; else if (anType === us.eAnTypes.pin) idOfType = us.APANNOTPIN; else if (anType === us.eAnTypes.ruler) idOfType = us.APANNOTCALIPER; else if (anType === us.eAnTypes.caliper) idOfType = us.APANNOTCALIPER; else if (anType === us.eAnTypes.text) idOfType = us.APANNOTTEXT; } } //............................................ annotation navigation icons setIconState($("#" + us.ANAVPREV), us.ANAVPREV, state); setIconState($("#" + us.ANAVNEXT), us.ANAVNEXT, state); if (isDefined(idOfType)) { // show the icon for this annotation type var jImg = $("#" + idOfType); var url = jImg.css("background-image"); // e.g. = url("http://localhost../images/PinDrop-24.png") //consoleWrite("anType: " + anType + " url:" + url); $("#" + us.idANAVCURRENT).css({ "background-image": url, "width": jImg.width(), "height": jImg.height(), "visibility": "visible" }).show(); var color = (isDefined(anObj)) ? "#" + toHexColor(anObj.getSelColor()) : "#FFFFFF"; // set the current tool icon background color to that of the selected icon $("#" + us.idANAVCURRENT).css({ "background-color": color }); } else { $("#" + us.idANAVCURRENT).css("visibility", "hidden"); // or hide the icon } if (us.DBGANNOTEX) consoleWrite("enableRegionNavigation: -" + state); //............................................ region icons: trash, colorpicker, note state = (uScope.canAnnotate() == false) ? "disabled" : state; setIconState($("#" + us.APTRASH), us.APTRASH, state); setIconState($("#" + us.APNOTE), us.APNOTE, state); /// if (us.ENABLEREDRAW == true) setIconState($("#" + us.APREDRAW), us.APREDRAW, state); setColorPickerState_(anObj, state); if (us.DBGANNOTEX) consoleWrite("enableRegionIcons: -" + state); }; //............................................ position() public // position - This function positions the annotations panel below the label or, if there is // no label, in the position that the label would have been placed. // Note that it assume the label has room below it... instead cOverLayout should be updated to handle this. this.position = function () { var thisImg = uScope.getThisImage(); // if (curiously) opened w/o an image or that image has no label if (uScope.isThisImageValid() == false || thisImg.hasALabel() == false || us.ENABLELABEL == false) { var rootPos = $(us.idHashROOT).offset(); var panelPos = [rootPos.left, Math.floor(rootPos.top + $(us.idHashROOT).height() / 3)]; } else { var jVpDiv = thisImg.vpDivGet("outer"); // place it relative to the label var offsetPos = jVpDiv.find("." + us.clsDIVLABEL).offset(); if (offsetPos == null || offsetPos == undefined) offsetPos = { "left": 0, "top": 0 }; var panelPos = [offsetPos.left, Math.floor(offsetPos.top + us.labelSpecs.width + 2 * us.kOVERLAY_ELEMENT_SPACE)]; } jPanel.dialog({ position: panelPos }); }; //............................................ activateDrawIcon_() local // activateDrawIcon_ - This function sets the specified drawing icon to the active state // and all all other drawing icons to the enabled state. var activateDrawIcon_ = function (jContainer, classRoot) { self.enableDrawingIcons(true); setIconState(jContainer, classRoot, "active"); }; //............................................ show() local var show = function (show) { if (show == true) { jPanel.dialog("open"); uScope.annotPanel.enableDrawingIcons(uScope.canAnnotate()); } else { jPanel.dialog("close"); } }; //............................................ colorSelCallBack_() local // colorSelCallBack_ - This function is called by the color picker when a color is selected. var colorSelCallBack_ = function (clr) { var thisImg = uScope.getThisImage(); if (thisImg) { thisImg.getAnnotObj().setSelColor(clr); } }; //............................................ bindEvents_() local // bindEvents_ - This function adds the annotation colorpicker panel event handlers. // // Note that an exception is made here and the namespace is not an image's namespace. var bindEvents_ = function () { var namespace = ".annotcolorpicker"; $(us.idHashROOT).on('click' + namespace, "." + us.TBANNOTPANEL + "-e", function () { show(true); setIconState($("#" + us.TBANNOTPANEL), us.TBANNOTPANEL, "active"); return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.TBANNOTPANEL + "-a", function () { show(false); setIconState($("#" + us.TBANNOTPANEL), us.TBANNOTPANEL, "enabled"); return false; }); $(us.idHashROOT).on(us.evIMAGESELECTED + namespace, function (e, parms) { self.enableDrawingIcons(uScope.canAnnotate()); // change the drawing icon state as a function of the selected image }); // deselecting active drawing tool $(us.idHashROOT).on('click', "." + us.APANNOTPIN + "-a" + ",." + us.APANNOTPEN + "-a" + ",." + us.APANNOTRECT + "-a" + ",." + us.APANNOTARROW + "-a" + ",." + us.APANNOTCALIPER + "-a" + ",." + us.APANNOTREPORT + "-a" + ",." + us.APANNOTELLIPSE + "-a" + ",." + us.APANNOTTEXT + "-a", function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); thisImg.navModeSwitch(us.eNavModes.nmNone); thisImg.vpDivGet().css('cursor', 'auto'); var targetId = e.currentTarget.id; setIconState($("#" + targetId), targetId, "enabled"); } }); // selecting enabled drawing tool $(us.idHashROOT).on('click' + namespace, "." + us.APANNOTPIN + "-e" + ",." + us.APANNOTPEN + "-e" + ",." + us.APANNOTRECT + "-e" + ",." + us.APANNOTARROW + "-e" + ",." + us.APANNOTCALIPER + "-e" + ",." + us.APANNOTREPORT + "-e" + ",." + us.APANNOTELLIPSE + "-e" + ",." + us.APANNOTTEXT + "-e", function (e) { if (uScope.isThisImageValid()) { var targetId = e.currentTarget.id; activateDrawIcon_($("#" + targetId), targetId); var navMode = us.eNavModes.nmAnnotPin; if (targetId == us.APANNOTPEN) navMode = us.eNavModes.nmAnnotPen; else if (targetId == us.APANNOTRECT) navMode = us.eNavModes.nmAnnotRect; else if (targetId == us.APANNOTARROW) navMode = us.eNavModes.nmAnnotArrow; else if (targetId == us.APANNOTCALIPER) navMode = us.eNavModes.nmAnnotCaliper; else if (targetId == us.APANNOTREPORT) navMode = us.eNavModes.nmAnnotReport; else if (targetId == us.APANNOTELLIPSE) navMode = us.eNavModes.nmAnnotEllipse; else if (targetId == us.APANNOTTEXT) navMode = us.eNavModes.nmAnnotText; var thisImg = uScope.getThisImage(); thisImg.navModeSwitch(navMode); } return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.APTRASH + "-e", function (e) { if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); thisImg.annots.regSelectDelete(); } return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.APANNOTCOLOR + "-e", function (e) { setIconState($("#" + us.APANNOTCOLOR), us.APANNOTCOLOR, "active"); if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); if (thisImg.getAnnotObj()) { var clr = thisImg.getAnnotObj().getSelColor(); // get color of currently selected region colorPicker.show(true, clr); } } return false; }); $(us.idHashROOT).on('click' + namespace, "." + us.APNOTE + "-e", function (e) { setIconState($("#" + us.APNOTE), us.APNOTE, "active"); if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); if (thisImg.getAnnotObj()) { var region = thisImg.getAnnotObj().getSelectedRegion(); if (region === undefined) return; // sanity check if (region.shape === 'text') openTextEditPanel("Update on image text", region.note, cb_addOnImageText); else if (region.isReportRegion) openTextEditPanel("Modify report region text", region.note, cb_addOnImageText); else openTextEditPanel("Add note for this region", region.note, cb_regAddNote); } } return false; }); //////////////////////////////////////// may be removed ////////////////////////////////////////////// // if (us.ENABLEREDRAW == true) { // $(us.idHashROOT).on('click' + namespace, "." + us.APREDRAW + "-e", function (e) { // if (uScope.isThisImageValid()) { // var thisImg = uScope.getThisImage(); // var shape = thisImg.getAnnotObj().getSelectedShape(); // if (shape == "pen") { // ///// as done above var targetId = e.currentTarget.id; // // activateDrawIcon_($("#" + targetId), targetId); // setIconState($("#" + us.APREDRAW), us.APREDRAW, "active"); // thisImg.navModeSwitch(us.eNavModes.nmRedrawStarting); //switch to redraw mode // //// thisImg.vpDivGet().css('cursor', 'pointer'); // } // } // return false; // }); // } /////////////////////////////////////////////////////////////////////////////////////////////////////////// $(us.idHashROOT).on('click' + namespace, "#" + us.ANAVPREV + ",#" + us.idANAVCURRENT + ",#" + us.ANAVNEXT, function (e) { var nextPrev = "previous"; if (e.currentTarget.id == us.idANAVCURRENT) nextPrev = "current"; else if (e.currentTarget.id == us.ANAVNEXT) nextPrev = "next"; if (uScope.isThisImageValid()) { var thisImg = uScope.getThisImage(); thisImg.getAnnotObj().regSelectNextPrev(nextPrev); } return false; }); }; //............................................ init_() local // init_ - This function creates and intializes the annotations panel var init_ = function () { jPanel = $('<div id=' + us.idANNOTPANEL + ' class=' + us.clsPANEL + ' title="Annotations"></div>'); // annotation region tools section jPanel.append($("<a/>", { "id": us.APANNOTARROW, "class": us.clsTBBUTTON + " " + us.APANNOTARROW + "-e", "title": "Add an arrow annotation" })); jPanel.append($("<a/>", { "id": us.APANNOTRECT, "class": us.clsTBBUTTON + " " + us.APANNOTRECT + "-e", "title": "Add a rectangular annotation" })); jPanel.append($("<a/>", { "id": us.APANNOTPEN, "class": us.clsTBBUTTON + " " + us.APANNOTPEN + "-e", "title": "Add a freeform annotation" })); jPanel.append($("<a/>", { "id": us.APANNOTPIN, "class": us.clsTBBUTTON + " " + us.APANNOTPIN + "-e", "title": "Add a pin annotation" })); jPanel.append("<div class='tooldivider tooldivider0'></div>"); // invisible horizontal line - keeps row of icons from shifting jPanel.append($("<a/>", { "id": us.APANNOTCALIPER, "class": us.clsTBBUTTON + " " + us.APANNOTCALIPER + "-e", "title": "Add a measurement annotation:\r click set points\r double-click to finish" })); jPanel.append($("<a/>", { "id": us.APANNOTREPORT, "class": us.clsTBBUTTON + " " + us.APANNOTREPORT + "-e", "title": "Add a report annotation" })); jPanel.append($("<a/>", { "id": us.APANNOTELLIPSE, "class": us.clsTBBUTTON + " " + us.APANNOTELLIPSE + "-e", "title": "Add an elliptcal annotation" })); jPanel.append($("<a/>", { "id": us.APANNOTTEXT, "class": us.clsTBBUTTON + " " + us.APANNOTTEXT + "-e", "title": "Add on-image text" })); jPanel.append("<div class='tooldivider'></div>"); // horizontal line jPanel.append($("<a/>", { "id": us.APTRASH, "class": us.clsTBBUTTON + " " + us.APTRASH + "-e", "title": "Delete the selected annotation" })); jPanel.append($("<a/>", { "id": us.APANNOTCOLOR, "class": us.clsTBBUTTON + " " + us.APANNOTCOLOR + "-e", "title": "Select a color for this annotation" })); jPanel.append($("<a/>", { "id": us.APNOTE, "class": us.clsTBBUTTON + " " + us.APNOTE + "-e", "title": "Add or update a note for this annotation" })); //// if (us.ENABLEREDRAW == true) jPanel.append($("<a/>", { "id": us.APREDRAW, "class": us.clsTBBUTTON + " " + us.APREDRAW + "-e", "title": "Edit freeform outline" })); // annotation navigation section jPanel.append("<div class='tooldivider'></div>"); // horizontal line var jAnNavDiv = jPanel.append($("<div>", { "id": us.idANNAVDIV })); jAnNavDiv = jPanel.find("#" + us.idANNAVDIV); jAnNavDiv.append($("<a/>", { "id": us.ANAVPREV, "class": us.clsANAVBUTTON + " " + us.ANAVPREV + "-e", "title": "Select previous annotation" })); jAnNavDiv.append($("<a/>", { "id": us.idANAVCURRENT, "class": us.clsBLANKBTN, "title": "Center the view on the selected annotation" })); jAnNavDiv.append($("<a/>", { "id": us.ANAVNEXT, "class": us.clsANAVBUTTON + " " + us.ANAVNEXT + "-e", "title": "Select next annotation" })); // convert div into dialog and use defaults var height = (BrowserDetect.isIE()) ? "200px" : "auto"; // IE adds vertical scrollbar in auto mode, so be specific $(jPanel).dialog({ autoOpen: false, closeOnEscape: true, resizable: false, width: 140, height: height , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { setIconState($("#" + us.TBANNOTPANEL), us.TBANNOTPANEL, "enabled"); } }); // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idANNOTPANEL).parent().appendTo(us.idHashROOT); self.position(); // position the panel colorPicker = new cColorPicker(colorSelCallBack_); // and create the color picker ////////////////////////////////todo: expose this differently???? self.publicColorPicker = colorPicker; //////////////////////////////// bindEvents_(); // add event handlers }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // cColorPicker Object //------------------------------------------------------------------------------------------------- function cColorPicker(callback) { var self = this; // local var for closure var jPanel; //............................................ show() public this.show = function (show, curColor) { if (show == true) { jPanel.dialog("open"); position(); set(curColor); } else jPanel.dialog("close"); }; //............................................ position() local var position = function () { var w = $("." + us.clsCLRPICKGRID).width(); var position = $('#' + us.idANNOTPANEL).offset(); // position color picker with respect to the annotation panel var panelPos = [Math.floor(position.left), Math.floor(position.top)]; $(jPanel).dialog({ position: panelPos, width: w + 20 }); }; //............................................ set() local var set = function (curColor) { if (jPanel.is(':visible')) { // if the colorpicker is visible, display the current color bar var curColorHex = "#" + toHexColor(curColor); // returns decimal RGB value in lower case hex characters $('#' + us.idCLRPICKDIV).uScopeColorPicker('selectByColor', curColorHex); $('#' + us.idCLRPCKBAR).css({ "background-color": curColorHex }); } }; //............................................ init() local // init = This function creates and intializes the color picker panel var init_ = function () { if (jPanel != undefined) jPanel.remove(); jPanel = $("<div/>", { "id": us.idCLRPICKPANEL, "class": us.clsPANEL, "title": "Select a Color" }); $(us.idHashROOT).append(jPanel); // first must add the panel to the root to be able to move it $("#" + us.idCLRPICKPANEL).dialog({ autoOpen: false, closeOnEscape: false, modal: true, draggable: true, resizable: false, stack: true, position: ['center', 'bottom'] , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , buttons: [ { text: "OK", click: function () { setIconState($("#" + us.APANNOTCOLOR), us.APANNOTCOLOR, "enabled"); $(this).dialog("close"); } }, { text: "Cancel", click: function () { setIconState($("#" + us.APANNOTCOLOR), us.APANNOTCOLOR, "enabled"); $(this).dialog("close"); } } ] }); // append this modal dialog to body to work around a jquery issue that modal dialogs cannot be dismissed in popup mode // (would normally want it appended to the uscope div) // note that the dialog is the parent to the panel created $('#' + us.idCLRPICKPANEL).parent().appendTo('body'); // add the div of color squares to the panel $('#' + us.idCLRPICKPANEL).append( $('<div id=' + us.idCLRPICKDIV + '></div>')); $('#' + us.idCLRPICKDIV).uScopeColorPicker({ // attach the color picker functionality to the div columns: 13, // number of columns click: function (clr) { // click event - selected color in hex is passed as arg. if (callback) callback(hexColortoRGB(clr)); $('#' + us.idCLRPICKPANEL).dialog('close'); setIconState($("#" + us.APANNOTCOLOR), us.APANNOTCOLOR, "enabled"); } }); var w = $("." + us.clsCLRPICKGRID).width(); $('#' + us.idCLRPICKPANEL).append($("<div/>", // and add a color bar div to display the selected color {"id": us.idCLRPCKBAR, "width": w-5, "height": 14 })); }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // color picker jquery plugin (function ($) { var selectedIdx; var settings; var methods = { init: function (options) { var defaults = { defaultColorIdx: 0, // default color index columns: 13, // number of color cells per row (0 means 1 row) divClass: us.clsCLRPICKGRID, // the div to place the color picker grid in colorPalette: new Array( "#ffaaaa", "#ffd4aa", "#ffffaa", "#d4ffaa", "#aaffaa", "#aaffd4", "#aaffff", "#aad4ff", "#aaaaff", "#d4aaff", "#ffaaff", "#ffaad4", "#ffffff", "#ff5656", "#ffaa56", "#ffff56", "#aaff56", "#56ff56", "#56ffaa", "#56ffff", "#56aaff", "#5656ff", "#aa56ff", "#ff56ff", "#ff007f", "#cfcfcf", "#ff0000", "#ff7f00", "#ffff00", "#7fff00", "#00ff00", "#00ff7f", "#00ffff", "#007fff", "#0000ff", "#7f00ff", "#ff00ff", "#ff007f", "#8f8f8f", "#bf0000", "#bf5f00", "#bfbf00", "#5fbf00", "#00bf00", "#00bf5f", "#00bfbf", "#005fbf", "#0000bf", "#5f00bf", "#bf00bf", "#bf005f", "#4f4f4f", "#7f0000", "#7f3f00", "#7f7f00", "#3f7f00", "#007f00", "#007f3f", "#007f7f", "#003f7f", "#00007f", "#3f007f", "#7f007f", "#7f003f", "#000000"), click: function ($colorCells) { } // user click event handler }; settings = $.extend({}, defaults, options); return this.each(function () { // construct color picker grid // in the immediate scope of the plugin function, the this keyword refers to the jQuery object the plugin was invoked on. var $this = $(this); // the associated parent html element selectedIdx = settings.defaultColorIdx; settings.columns = (settings.columns > 0) ? settings.columns : settings.color.length; var sCells = ""; // create abd add the color grid to the parent with the specified class for (var i = 0; i < settings.colorPalette.length; i++) sCells += '<div style="background-color:' + settings.colorPalette[i] + ';"></div>'; $this.html('<div class=\"' + settings.divClass + '\">' + sCells + '</div>'); $colorCells = $this.children('.' + settings.divClass).children('div'); // select the grid's color cells var w = ($colorCells.width() + 4) * settings.columns; // set width of cell grid = space between cells x N cells/row $('.' + settings.divClass).css('width', w); $colorCells.each(function (i) { // add click event to each cell $(this).click(function () { methods.setCheckState(i); // check the appropriate div settings.click(settings.colorPalette[i]); // issue user click }); }); methods.setCheckState(settings.defaultColorIdx); // check the appropriate div selectedIdx = settings.defaultColorIdx; // save the selected color idx }); return this; // returning this maintains chainability }, selectByIdx: function (idx) { // set the color selection to the color in the palette at the specified index methods.setCheckState(idx); }, selectByColor: function (hexColor) { // set the color selection to the passed hex color, e.g. "#ffff56" for (var i = 0; i < settings.colorPalette.length; i++) { if (settings.colorPalette[i] == hexColor) { methods.setCheckState(i); break; } } }, getColorPalette: function () { // get the color palette array return settings.colorPalette; }, getSelColor: function () { // get the selected color, in hex, e.g. "#ffff56" return settings.colorPalette[selectedIdx]; }, //---------------------------------------------------------- private methods ------------------------------------------------- setCheckState: function (i) { if (selectedIdx == i) return; // nothing to do if (i == -1 || i > settings.colorPalette.length - 1) i = 0; // keep index in-bounds if (selectedIdx > -1) { // clean up check state in previous color cell $cell = $colorCells.eq(selectedIdx); if ($cell.hasClass('check')) $cell.removeClass('check').removeClass('checkwht').removeClass('checkblk'); } selectedIdx = i; // save the selected color idx $cell = $colorCells.eq(selectedIdx); // set checkmark in selected color var setWhiteFont = methods.setWhiteFont(settings.colorPalette[i]); $cell.addClass('check').addClass(setWhiteFont ? 'checkwht' : 'checkblk'); }, setWhiteFont: function (hexColor) { // compute brightness of color by converting to the Y component of YUV, which is brightness or luminance var decRGB = parseInt(hexColor.substr(1), 16); // integer RGB value var blue = (decRGB & 0xFF); var green = (decRGB >> 8) & 0xFF; var red = (decRGB >> 16) & 0xFF; // don't need U and V, but fyi, they are: U = 0.436 * (blue - Y) / (1 / 0.114); V = 0.615 * (red - Y) / (1 / 0.299); var Y = parseInt((red * 0.299) + (green * 0.587) + (blue * 0.114)); return (Y > 139) ? false : true; } }; $.fn.uScopeColorPicker = function (method) { var settings; // settings array var selectedIdx = -1; // selected index in color array var $colorCells; // the color cells jq object if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.uScopeColorPicker'); } }; })(jQuery); //------------------------------------------------------------------------------------------------- // cConsolePanel //------------------------------------------------------------------------------------------------- function cConsoleSwitchPanel() { var self = this; // local var for closure var jPanel; // for quick access //............................................ show() public this.show = function (show) { if (show == true) jPanel.dialog("open"); else jPanel.dialog("close"); }; //............................................ dbgSwitchChange() local // dbgSwitchChange - This function var dbgSwitchChange = function (name) { switch (name) { case "DBGSTART": us.DBGSTART = !us.DBGSTART; break; case "DBGXINFO": us.DBGXINFO = !us.DBGXINFO; break; case "DBGANNOT": us.DBGANNOT = !us.DBGANNOT; break; case "DBGPDNAV": us.DBGPDNAV = !us.DBGPDNAV; break; case "DBGCONF": us.DBGCONF = !us.DBGCONF; break; case "DBGPREFETCH": us.DBGPREFETCH = !us.DBGPREFETCH; break; case "DBGCACHE": us.DBGCACHE = !us.DBGCACHE; break; case "DBGMOVETIME": us.DBGMOVETIME = !us.DBGMOVETIME; us.DBGVIEWTIME = (us.DBGMOVETIME || us.DBGREFRESHTIME); break; case "DBGREFRESHTIME": us.DBGREFRESHTIME = !us.DBGREFRESHTIME; us.DBGVIEWTIME = (us.DBGMOVETIME || us.DBGREFRESHTIME); break; case "DBGIOS": us.DBGIOS = !us.DBGIOS; break; case "ALL": us.DBGSTART = false; us.DBGXINFO = false; us.DBGANNOT = false; us.DBGPDNAV = false; us.DBGCONF = false; us.DBGPREFETCH = false; us.DBGCACHE = false; us.DBGMOVETIME = false; us.DBGREFRESHTIME = false; us.DBGVIEWTIME = false; us.DBGIOS = false; break; default: consoleWrite("dbgSwitchChange: unknown switch name: " + name); } }; //............................................ init_() local // init_ - This function creates and intializes the panel var init_ = function () { jPanel = $('<div id=' + us.idDBGSWITCHPANEL + ' class=' + us.clsPANEL + ' title="Debug Report Options"></div>'); $(us.idHashROOT).append(jPanel); // first must add the panel to the root to be able to move it $("#" + us.idDBGSWITCHPANEL).dialog({ autoOpen: false, // call to create the panel closeOnEscape: true, draggable: true, stack: true, resizable: false , width: 240, position: ['center', 'center'] , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , buttons: [ { text: "Reset", click: function () { $('input').attr('checked', false); dbgSwitchChange("ALL"); } }, { text: "OK", click: function () { self.show(false); } } ] }); // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idDBGSWITCHPANEL).parent().appendTo(us.idHashROOT); var checkboxes = '<div>' + '<br><input type=\"checkbox\" title=\"Log start data.\"' + (us.DBGSTART == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGSTART\" value=\"DBGSTART\" /> Start' + '<br><input type=\"checkbox\" title=\"Log xinfo request data.\"' + (us.DBGXINFO == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGXINFO\" value=\"DBGXINFO\" /> Xinfo' + '<br><input type=\"checkbox\" title=\"Log annotation activity.\"' + (us.DBGANNOT == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGANNOT\" value=\"DBGANNOT\" /> Annotations' + '<br><input type=\"checkbox\" title=\"Log pin drop navigation activity.\"' + (us.DBGPDNAV == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGPDNAV\" value=\"DBGPDNAV\" /> Pin Drop Navigation' + '<br><input type=\"checkbox\" title=\"Log conferencing activity.\"' + (us.DBGCONF == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGCONF\" value=\"DBGCONF\" /> Conferencing' + '<br><input type=\"checkbox\" title=\"Log image tile prefetch activity.\"' + (us.DBGPREFETCH == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGPREFETCH\" value=\"DBGPREFETCH\" /> Prefetch' + '<br><input type=\"checkbox\" title=\"Log image tile cache activity.\"' + (us.DBGCACHE == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGCACHE\" value=\"DBGCACHE\" /> Cache' + '<br><input type=\"checkbox\" title=\"Log image tile cache activity.\"' + (us.DBGMOVETIME == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGMOVETIME\" value=\"DBGMOVETIME\" /> View Move' + '<br><input type=\"checkbox\" title=\"Log image tile cache activity.\"' + (us.DBGREFRESHTIME == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGREFRESHTIME\" value=\"DBGREFRESHTIME\" /> View Refresh' + '<br><input type=\"checkbox\" title=\"Log IOS specific actions.\"' + (us.DBGIOS == true ? '\" checked=\"yes\"' : '') + ' name=\"DBGIOS\" value=\"DBGIOS\" /> IOS' + '</div>'; $("#" + us.idDBGSWITCHPANEL).html(checkboxes); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// add event handlers $(us.idHashROOT).on('change',"#" + us.idDBGSWITCHPANEL + ".input", function (e) { consoleWrite("idDBGSWITCHPANEL: change: " + this.name); dbgSwitchChange(this.name); }); } //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- function cConsolePanel() { var self = this; // local var for closure var jPanel; // for quick access var consoleSwitchPanel; //............................................ show() public this.show = function (show) { if (show == true) { jPanel.dialog("open"); consoleWrite("- - - - - ");// force output } else jPanel.dialog("close"); }; //............................................ init_() local // init_ - This function creates and intializes the panel var init_ = function () { if (consoleSwitchPanel != undefined) consoleSwitchPanel = undefined; consoleSwitchPanel = new cConsoleSwitchPanel(); if (jPanel != undefined) jPanel.remove(); jPanel = $('<div id=' + us.idDBGCONSOLE + ' class=' + us.clsPANEL + ' title="Console"></div>'); $(us.idHashROOT).append(jPanel); // first must add the panel to the root to be able to move it var panelWidth = (BrowserDetect.isIOS()) ? 400 : 650; $("#" + us.idDBGCONSOLE).dialog({ autoOpen: false, // call to create the panel closeOnEscape: true, draggable: true, stack: true , width: panelWidth, height: 300, maxHeight: 600, position: ['center', 'bottom'] , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { $(this).remove(); } , buttons: [ { text: "Clear", click: function () { us.consoleSpecs.msgCnt = -1; us.consoleSpecs.msg.length = 0; consoleWrite(""); } }, { text: "About", click: function () { consoleWrite(uScope.getProgName() + " " + uScope.getProgVersion() + " " + uScope.getProgDate()); consoleWrite(BrowserDetect.report()); } }, { text: "Options", click: function () { consoleSwitchPanel.show(true); } }, { text: "OK", click: function () { self.show(false); } } ] }); // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created $('#' + us.idDBGCONSOLE).parent().appendTo(us.idHashROOT); }; //............................................ construction init_(); }; //............................................ consoleWrite // consoleWrite - This functions adds the passed message to the console text // // - note that I do not know if it would be better to append a new div with the new message or do what I'm doing // - note that the scroll bar doesn't work until I resize the window // parameters: // msg: the string to log // imageId: optional, if present is prepended to log message function consoleWrite(msg, imageId) { //todo: make this more efficient //todo: fix the ever increasing time consumed by Log4js msg = "uScope: " + ((imageId != undefined) ? imageId + ": " + msg : msg); var consoleSpecs = us.consoleSpecs; if ((msg != undefined) && typeof console !== "undefined" && typeof console.log !== "undefined") console.log(msg); if (msg != undefined && msg.length) { if (++consoleSpecs.msgCnt > consoleSpecs.msgMax) // update the message number consoleSpecs.msgCnt = 1; consoleSpecs.msg.push("<br>" + consoleSpecs.msgCnt + " " + msg); if (consoleSpecs.msg.length > consoleSpecs.msgMax) // don't keep too many old messages consoleSpecs.msg.shift(); } // N calls to logging problem // if ((typeof Log4js !== "undefined") && (typeof Log4js.Logger !== "undefined")) { // try { // var logger = new Log4js.Logger("uScope"); // logger.addAppender(new Log4js.ConsoleAppender(logger, true)); // //TODO: uScope Logging id defaulted to ALL. This should come from the Config.LogLevelJavascript variable // logger.setLevel(Log4js.Level.ALL); // var ajaxAppender = new Log4js.AjaxAppender("/PALModules/JsErrorHandlerReceiver.php"); // logger.addAppender(ajaxAppender); // ajaxAppender.setThreshold(1); // logger.info(msg); // } catch (err) { // } // } var jPanel = $("#" + us.idDBGCONSOLE); // return if the console hasn't been created or isn't visible if ( jPanel.is(':visible') === false || jPanel.length === 0 ) return; var jdiv = jPanel.find("div").remove(); // remove the previous message set var jInfo = $('<div id=/"' + us.idDBGCONSOLELOG + '/">' + consoleSpecs.msg + '</div>'); jPanel.append(jInfo); // and write this one }; //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- // openTextEditPanel - This method builds and shows/hides the a panel for text editing. function openTextEditPanel(inTitle, inText, callback, crsrPos) { if (!uScope.isThisImageValid()) return; // if there is no image opened just exit var self = this; // needed for closure var hotKeyState = us.ENABLEDEVHOTKEYS; // during development, don't let hotkeys interfere with text input if (hotKeyState) us.ENABLEDEVHOTKEYS = false; if (isUnDefined(inText)) inText = ""; this.inCrsrPos = crsrPos; // save for on click this.callback = callback; // save for on click var jPanel = $('#' + us.idTEXTEDITPANEL); if (!jPanel.length) { var jPanel = $("<div/>", { "id": us.idTEXTEDITPANEL, "class": us.clsPANEL }); $(us.idHashROOT).append(jPanel); // first must add the panel to the root to be able to move it $("#" + us.idTEXTEDITPANEL).dialog({ autoOpen: false, draggable: true, resizable: false, stack: true, modal: true, width: us.textEditSpecs.width, minWidth: us.textEditSpecs.width, height: us.textEditSpecs.height, minHeight: us.textEditSpecs.height , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , buttons: [ { text: "Cancel", click: function () { jPanel.find('textarea').val(""); // clear text and close $(this).dialog("close"); us.ENABLEDEVHOTKEYS = hotKeyState; if (self.callback) callback(self.inCrsrPos); // return no text to indicate cancel } }, { text: "Ok", click: function () { var jtext = jPanel.find('textarea'); var outText = $(jtext).val(); jtext.val(""); // clear text and close $(this).dialog("close"); us.ENABLEDEVHOTKEYS = hotKeyState; if (self.callback) self.callback(self.inCrsrPos, outText); // return updated text, style selections } }, // for testing only ........................................................................... // {// for testing text box - do not deliver! // text: "Test", click: function () { // $(this).dialog("close"); // us.ENABLEDEVHOTKEYS = hotKeyState; // var outText = "1"; // for (var t = 2; t < us.textEditSpecs.maxChars+10; t++) { // outText += (t % 10); // if (t % 10 == 0) outText += ' '; // if (t % 50 == 0) outText += '\n'; // } // if (callback) // callback(self.inCrsrPos, outText); // return updated text, style selections // } // } // {// for testing text box - do not deliver! // text: "Test2", click: function () { // $(this).dialog("close"); // us.ENABLEDEVHOTKEYS = hotKeyState; // // this text includes user-defined carriage returns for format checking: cr between words, at start and at end of words // var outText = "Life is a journey. Death is a return to earth.\n" // +"The universe is like an inn.\nThe passing years are like dust. " // +"\nRegard this phantom world as a star at dawn,\na bubble in a stream, " // +"a flash of lightning in a summer cloud, a flickering lamp \n- a phantom - and a dream." // if (callback) // callback(self.inCrsrPos, outText); // return updated text, style selections // } // } //............................................................................................. ], resize: function (event, ui) { jTextArea = $("textarea"); consoleWrite("hello from edit panel resize"); var w = $("#" + us.idTEXTEDITPANEL).width() - 10; var h = $("#" + us.idTEXTEDITPANEL).height() - 10; jTextArea.width(w); jTextArea.height(h); } }); var jInfo = $('<textarea>' + inText + '</textarea>').css("resize", "none").width(us.textEditSpecs.width - 30).height(us.textEditSpecs.height - 120); jPanel.append(jInfo); // add the text to the panel // append this modal dialog to body to work around a jquery issue that modal dialogs cannot be dismissed in popup mode // (would normally want it appended to the uscope div) // note that the dialog is the parent to the panel created $('#' + us.idTEXTEDITPANEL).parent().appendTo('body'); } else { var jtext = jPanel.find('textarea'); $(jtext).val(inText); } jPanel.dialog("option", "title", inTitle); toggleDialog(us.idTEXTEDITPANEL); // if the panel is visible/hidden then hide/show it }; //------------------------------------------------------------------------------------------------- // PLUG IN PANEL //------------------------------------------------------------------------------------------------- function cPlugInPanel() { var self = this; // local var for closure var jPanel; //............................................ add() public // add - This function adds icons to the plugin panel this.add = function (iconClass, tooltip) { if (iconClass == undefined) return false; jPanel.append($("<a/>", { "id": iconClass, "class": us.clsTBBUTTON + " " + iconClass + "-e", "title": tooltip })); return true; }; //............................................ show() local var show = function (show) { if (show == true) jPanel.dialog("open"); else jPanel.dialog("close"); }; //............................................ init_() local // init_ = This function creates and intializes the plugin panel var init_ = function () { jPanel = $('<div id=' + us.idPLUGINPANEL + ' class=' + us.clsPANEL + ' title="PlugIns">&nbsp;&nbsp;Hello Dory</div>'); jPanel.append("<div class='tooldivider tooldivider0'></div>"); // invisible horizontal line - keeps row of icons from shifting // convert div into dialog and use defaults $(jPanel).dialog({ autoOpen: false, closeOnEscape: true , resizable: true , width: 140, height: 400 , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { setIconState($("#" + us.TBPLUGINPANEL), us.TBPLUGINPANEL, "enabled"); } }); // append this modeless dialog to uscope's root div - the dialog is the parent to the panel created jPanel.parent().appendTo(us.idHashROOT); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// add plugin panel event handlers $(us.idHashROOT).on('click', "." + us.TBPLUGINPANEL + "-e", function () { show(true); setIconState($("#" + us.TBPLUGINPANEL), us.TBPLUGINPANEL, "active"); return false; }); $(us.idHashROOT).on('click', "." + us.TBPLUGINPANEL + "-a", function () { show(false); setIconState($("#" + us.TBPLUGINPANEL), us.TBPLUGINPANEL, "enabled"); return false; }); }; //............................................ construction init_(); }; //------------------------------------------------------------------------------------------------- // ICON MANAGEMENT //------------------------------------------------------------------------------------------------- //............................................ setIconState // setIconState - This function sets an icon to its active, enabled or disabled state // OR sets the muti-image icon to one of its 3 possible states. // // Note that it depends upon the css class naming convention: // classRoot-e - defines icon for enabled state // classRoot-d - defines icon for disabled state // classRoot-a - defines icon for active state // function setIconState(jContainer, classRoot, state) { if (state == "active") // most toolbar icon states jContainer.addClass(classRoot + "-a").removeClass(classRoot + "-e").removeClass(classRoot + "-d"); else if (state == "enabled") jContainer.addClass(classRoot + "-e").removeClass(classRoot + "-a").removeClass(classRoot + "-d"); else if (state == "disabled") jContainer.addClass(classRoot + "-d").removeClass(classRoot + "-e").removeClass(classRoot + "-a"); else if (state == "t")//multi image icon states jContainer.addClass(classRoot + "-4").removeClass(classRoot + "-v").removeClass(classRoot + "-h").removeClass(classRoot + "-d"); else if (state == "v") jContainer.addClass(classRoot + "-v").removeClass(classRoot + "-4").removeClass(classRoot + "-h").removeClass(classRoot + "-d"); else if (state == "h") jContainer.addClass(classRoot + "-h").removeClass(classRoot + "-4").removeClass(classRoot + "-v").removeClass(classRoot + "-d"); else if (state == "d" || state == "1" || state == "4") jContainer.addClass(classRoot + "-d").removeClass(classRoot + "-h").removeClass(classRoot + "-v").removeClass(classRoot + "-4"); else return; if (us.DBGANNOTEX) consoleWrite("setIconState: " + classRoot + " -" + state); }; //------------------------------------------------------------------------------------------------- // DIALOG HELPER METHODS //------------------------------------------------------------------------------------------------- //............................................ genericMessage // genericMessage - A general purpose message panel that removes itself from the DOM when closed. // // parameters: // message: required, string, your message to the user // title: optional, string, default "Notice" // function genericMessage(message, title) { if (message == undefined) message = ""; title = (title != undefined) ? title : "Notice"; var jPanel = $('<div id=' + us.idMSGPANEL + ' title=\"' + title + '\">' + message + '</div>'); $(us.idHashROOT).append(jPanel); // add the panel to the root $(jPanel).dialog({ autoOpen: true, modal: true, closeOnEscape: false, resizable: false , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { $(this).remove(); } , buttons: [{ text: "OK", click: function () { $(this).remove(); } }] }); // append this modal dialog to body to work around a jquery issue that modal dialogs cannot be dismissed in popup mode // (would normally want it appended to the uscope div) // note that the dialog is the parent to the panel created $('#' + us.idMSGPANEL).parent().appendTo('body'); }; //............................................ genericConfirm // genericConfirm - A general purpose confirm panel that removes itself from the DOM when closed. // // parameters: // message: required, string, your message to the user // title: required, string // callback: required function genericConfirm(message, title, callback, callbackJson) { if (message == undefined) message = ""; if (title == undefined) title = ""; if (message.length == 0 && message.length == 0) return; us.idCONFIRMPANEL = "us_idCONFIRMPANEL"; //////////move me var jPanel = $('<div id=' + us.idCONFIRMPANEL + ' title=\"' + title + '\">' + message + '</div>'); $(us.idHashROOT).append(jPanel); // add the panel to the root $(jPanel).dialog({ autoOpen: true, modal: true, closeOnEscape: false, resizable: false , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { $(this).remove(); } , buttons: [{ text: "No", click: function () { $(this).remove(); if (callback) callback(callbackJson, false); return false; } } , { text: "Yes", click: function () { $(this).remove(); if (callback) callback(callbackJson, true); return true; } }] }); // append this modal dialog to body to work around a jquery issue that modal dialogs cannot be dismissed in popup mode // (would normally want it appended to the uscope div) // note that the dialog is the parent to the panel created $('#' + us.idMSGPANEL).parent().appendTo('body'); }; //------------------------------------------------------------------------------------------------- // genericInput - A general purpose dialog that returns a user input and removes itself from the DOM when closed. // // parameters: // message: required, string, your message to the user // title: required, string, // callback: optional: function genericInput(message, title, callback) { if (message == undefined) message = ""; title = (title != undefined) ? title : ""; var html = +'<br><br><Input type = radio Name = rptType class =\"' + us.clsREPORTTYPE + '\" Value = "0" checked> Full Resolution Image,<br>&nbsp;&nbsp; Fixed Sized Report Region' + '</div>'; var html1 = '<div id=' + us.idMSGPANEL + ' title=\"' + title + '\">' + message + '&nbsp;&nbsp;&nbsp;&nbsp;' + '<input id=\"' + us.idMSGPANELINPUT + '\" type="text" value=' + "" + '></input>' + '</div>'; var jPanel = $(html1); $(us.idHashROOT).append(jPanel); // add the panel to the root $(jPanel).dialog({ autoOpen: true, modal: true, closeOnEscape: false, resizable: false , width: "auto" , dialogClass: "dialogMover" // allows the dialog to move outside of its container - very important in HC , close: function (event, ui) { $(this).remove(); } , buttons: [{ text: "OK", click: function () { if (callback) callback($("#" + us.idMSGPANELINPUT).val()); $(this).remove(); } }] }); // append this modal dialog to body to work around a jquery issue that modal dialogs cannot be dismissed in popup mode // (would normally want it appended to the uscope div) // note that the dialog is the parent to the panel created $('#' + us.idMSGPANEL).parent().appendTo('body'); }; //------------------------------------------------------------------------------------------------- // toggleDialog - This function toggles the visiblity of the passed dialog and return its visiblity {true,false}. function toggleDialog(idDialog) { if ($("#" + idDialog).is(':visible')) { // if the idDialog is open, close it $("#" + idDialog).dialog("close"); return false; } else { // and visa-versa $("#" + idDialog).dialog("open"); return true; } }; //------------------------------------------------------------------------------------------------- // closeDialog - This function closes the specified dialog (aka panel). // It returns true if it had been open, false if it had been closed. function closeDialog(idDialog) { if ($("#" + idDialog).is(':visible')) { $("#" + idDialog).dialog("close"); return true; } return false; }; //________________________________________________________________________________________________ //............................................ jQuery.fn.contextToolbar // jQuery plugin for right click context toolbar. // Usage: // $('.something').contextToolbar({ // title: 'Some title', // items: [ // {icon:'/images/icon1.png', action:function() { }, tooltip: 'friendly'}, // {icon:'/images/icon2.png', action:function() { }, tooltip: 'philly'}, // null, // divider // {icon:'/images/icon3.png', action:function() { }, tooltip: 'city'}, // ] // }); // This code is derived from Joe Walnes https://github.com/joewalnes/jquery-simple-context-menu // jQuery.fn.contextToolbar = function (options) { var settings = { // Define default settings parent: document.body, toolbarClass: 'contextToolBar', additionalClass: '', titleClass: 'title', seperatorClass: 'divider', title: 'Title', callback: undefined, items: [] }; $.extend(settings, options); //............................................ createMenu function createMenu(e) { // Build toolbar HTML var menu = $('<div class="' + settings.toolbarClass + ' ' + settings.additionalClass + '"></div>').appendTo(settings.parent); if (settings.title) $('<div class="' + settings.titleClass + '"></div>').text(settings.title).appendTo(menu); settings.items.forEach(function (item) { if (item) { if (item.icon || item.className || item.id) { var rowCode = '<div></div>'; var row = $(rowCode).appendTo(menu); var icon = $('<img>'); if (item.icon) icon.attr('src', item.icon); if (item.className) icon.attr('class', item.className); if (item.id) icon.attr('id', item.id); if (item.tooltip) icon.attr('title', item.tooltip); $(row).append(icon); if (item.action) row.find('img').click(function () { item.action(e); }); } } else { $('<div class="' + settings.seperatorClass + '"></div>').appendTo(menu); } }); menu.find('.' + settings.titleClass).text(settings.title); menu.mouseleave(function () { // when the mouse leaves the toolbar, remove it from the DOM menu.remove(); return false; }); return menu; }; //............................................ bind this.bind('contextmenu', function (e) { // On contextmenu event (right click) var menu = createMenu(e).show(); var left = e.pageX + 5, // nudge to the right, so the pointer is covering the title top = e.pageY; if (top + menu.height() >= $(parent).height()) top -= menu.height(); if (left + menu.width() >= $(parent).width()) left -= menu.width(); // Create and show menu menu.css({ left: left, top: top }).bind('contextmenu', function () { return false; }); // // Cover rest of page with invisible div that when clicked will cancel the popup. // var bg = $('<div></div>') // .css({ left: 0, top: 0, width: '100%', height: '100%', position: 'absolute', zIndex: 1000000 }) // .appendTo(parent) // .bind('contextmenu click', function () { // bg.remove(); // If click or right click anywhere else on page: remove clean up. // menu.remove(); // return false; // }); if (settings.callback) settings.callback(left, top); return false; // Cancel event, so real browser popup doesn't appear. }); return this; }; //________________________________________________________________________________________________
{ "content_hash": "3e19d1c45bacd8b6449cfbe4848ecde4", "timestamp": "", "source": "github", "line_count": 3273, "max_line_length": 211, "avg_line_length": 48.72593950504125, "alnum_prop": 0.5860609480812641, "repo_name": "richstoner/richstoner.github.com", "id": "a4ad3e08311e27010e0903a0c39eabc0ad2bdb93", "size": "164894", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lbswebgl/js/toolbar.js", "mode": "33261", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "5000" }, { "name": "CSS", "bytes": "713372" }, { "name": "CoffeeScript", "bytes": "5077" }, { "name": "JavaScript", "bytes": "8317275" }, { "name": "Python", "bytes": "3523" }, { "name": "Shell", "bytes": "6295" } ], "symlink_target": "" }
"use strict"; var conn = require('./ForceConnection.js').connection; var listCustomObjectsModel = require('./forceModel/listCustomObjects.js'); var listObjectsModel = require('./forceModel/listObjects.js'); var describeSObject = require('./forceModel/describeSObject.js'); var logger = require('../services/logger.js'); var init = function(apiModel) { apiModel.registerSecuredRoute('get' , 'objects' , '/objects' , listObjects , { 'token': {'required': true, 'dataType': 'string'}, 'includeStandardObjects': {'required': false, 'dataType': 'boolean'} } , 'JSON list of Objects'); } var listObjects =function(req, res, next) { var includeStandardObjects = req.query.includeStandardObjects; var service = includeStandardObjects ? listObjectsModel : listCustomObjectsModel; service.init(conn); var p = service.execute(); p.then(function(objects) { var objectMap = {}; var results = objects.map(function(x) { var result = {}; result.describeUri = '/objects/' + x.name + '?token=' + req.query.token; result.name = x.name; result.label = x.label; result.labelPlural = x.labelPlural; return result; }); res.json(results) }); } exports.init = init;
{ "content_hash": "84df3fd9a6374e6da89cb8aadb20e8db", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 85, "avg_line_length": 28.93617021276596, "alnum_prop": 0.6102941176470589, "repo_name": "james-gibson/forceTooling", "id": "b635e40d7c0fb39abede28799c14319dfceb268e", "size": "1360", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/model/listObjects.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4403" }, { "name": "HTML", "bytes": "4648" }, { "name": "JavaScript", "bytes": "20873" } ], "symlink_target": "" }
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v12/common/user_lists.proto package com.google.ads.googleads.v12.common; /** * <pre> * UserList of CRM users provided by the advertiser. * </pre> * * Protobuf type {@code google.ads.googleads.v12.common.CrmBasedUserListInfo} */ public final class CrmBasedUserListInfo extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:google.ads.googleads.v12.common.CrmBasedUserListInfo) CrmBasedUserListInfoOrBuilder { private static final long serialVersionUID = 0L; // Use CrmBasedUserListInfo.newBuilder() to construct. private CrmBasedUserListInfo(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private CrmBasedUserListInfo() { appId_ = ""; uploadKeyType_ = 0; dataSourceType_ = 0; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new CrmBasedUserListInfo(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.common.UserListsProto.internal_static_google_ads_googleads_v12_common_CrmBasedUserListInfo_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.common.UserListsProto.internal_static_google_ads_googleads_v12_common_CrmBasedUserListInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.common.CrmBasedUserListInfo.class, com.google.ads.googleads.v12.common.CrmBasedUserListInfo.Builder.class); } private int bitField0_; public static final int APP_ID_FIELD_NUMBER = 4; private volatile java.lang.Object appId_; /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @return Whether the appId field is set. */ @java.lang.Override public boolean hasAppId() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @return The appId. */ @java.lang.Override public java.lang.String getAppId() { java.lang.Object ref = appId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); appId_ = s; return s; } } /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @return The bytes for appId. */ @java.lang.Override public com.google.protobuf.ByteString getAppIdBytes() { java.lang.Object ref = appId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } public static final int UPLOAD_KEY_TYPE_FIELD_NUMBER = 2; private int uploadKeyType_; /** * <pre> * Matching key type of the list. * Mixed data types are not allowed on the same list. * This field is required for an ADD operation. * </pre> * * <code>.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType upload_key_type = 2;</code> * @return The enum numeric value on the wire for uploadKeyType. */ @java.lang.Override public int getUploadKeyTypeValue() { return uploadKeyType_; } /** * <pre> * Matching key type of the list. * Mixed data types are not allowed on the same list. * This field is required for an ADD operation. * </pre> * * <code>.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType upload_key_type = 2;</code> * @return The uploadKeyType. */ @java.lang.Override public com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType getUploadKeyType() { @SuppressWarnings("deprecation") com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType result = com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType.valueOf(uploadKeyType_); return result == null ? com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType.UNRECOGNIZED : result; } public static final int DATA_SOURCE_TYPE_FIELD_NUMBER = 3; private int dataSourceType_; /** * <pre> * Data source of the list. Default value is FIRST_PARTY. * Only customers on the allow-list can create third-party sourced CRM lists. * </pre> * * <code>.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType data_source_type = 3;</code> * @return The enum numeric value on the wire for dataSourceType. */ @java.lang.Override public int getDataSourceTypeValue() { return dataSourceType_; } /** * <pre> * Data source of the list. Default value is FIRST_PARTY. * Only customers on the allow-list can create third-party sourced CRM lists. * </pre> * * <code>.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType data_source_type = 3;</code> * @return The dataSourceType. */ @java.lang.Override public com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType getDataSourceType() { @SuppressWarnings("deprecation") com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType result = com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType.valueOf(dataSourceType_); return result == null ? com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType.UNRECOGNIZED : result; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (uploadKeyType_ != com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType.UNSPECIFIED.getNumber()) { output.writeEnum(2, uploadKeyType_); } if (dataSourceType_ != com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType.UNSPECIFIED.getNumber()) { output.writeEnum(3, dataSourceType_); } if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 4, appId_); } getUnknownFields().writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (uploadKeyType_ != com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType.UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(2, uploadKeyType_); } if (dataSourceType_ != com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType.UNSPECIFIED.getNumber()) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(3, dataSourceType_); } if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, appId_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.ads.googleads.v12.common.CrmBasedUserListInfo)) { return super.equals(obj); } com.google.ads.googleads.v12.common.CrmBasedUserListInfo other = (com.google.ads.googleads.v12.common.CrmBasedUserListInfo) obj; if (hasAppId() != other.hasAppId()) return false; if (hasAppId()) { if (!getAppId() .equals(other.getAppId())) return false; } if (uploadKeyType_ != other.uploadKeyType_) return false; if (dataSourceType_ != other.dataSourceType_) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasAppId()) { hash = (37 * hash) + APP_ID_FIELD_NUMBER; hash = (53 * hash) + getAppId().hashCode(); } hash = (37 * hash) + UPLOAD_KEY_TYPE_FIELD_NUMBER; hash = (53 * hash) + uploadKeyType_; hash = (37 * hash) + DATA_SOURCE_TYPE_FIELD_NUMBER; hash = (53 * hash) + dataSourceType_; hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(com.google.ads.googleads.v12.common.CrmBasedUserListInfo prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * <pre> * UserList of CRM users provided by the advertiser. * </pre> * * Protobuf type {@code google.ads.googleads.v12.common.CrmBasedUserListInfo} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:google.ads.googleads.v12.common.CrmBasedUserListInfo) com.google.ads.googleads.v12.common.CrmBasedUserListInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.google.ads.googleads.v12.common.UserListsProto.internal_static_google_ads_googleads_v12_common_CrmBasedUserListInfo_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return com.google.ads.googleads.v12.common.UserListsProto.internal_static_google_ads_googleads_v12_common_CrmBasedUserListInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( com.google.ads.googleads.v12.common.CrmBasedUserListInfo.class, com.google.ads.googleads.v12.common.CrmBasedUserListInfo.Builder.class); } // Construct using com.google.ads.googleads.v12.common.CrmBasedUserListInfo.newBuilder() private Builder() { } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); } @java.lang.Override public Builder clear() { super.clear(); appId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); uploadKeyType_ = 0; dataSourceType_ = 0; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return com.google.ads.googleads.v12.common.UserListsProto.internal_static_google_ads_googleads_v12_common_CrmBasedUserListInfo_descriptor; } @java.lang.Override public com.google.ads.googleads.v12.common.CrmBasedUserListInfo getDefaultInstanceForType() { return com.google.ads.googleads.v12.common.CrmBasedUserListInfo.getDefaultInstance(); } @java.lang.Override public com.google.ads.googleads.v12.common.CrmBasedUserListInfo build() { com.google.ads.googleads.v12.common.CrmBasedUserListInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public com.google.ads.googleads.v12.common.CrmBasedUserListInfo buildPartial() { com.google.ads.googleads.v12.common.CrmBasedUserListInfo result = new com.google.ads.googleads.v12.common.CrmBasedUserListInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) != 0)) { to_bitField0_ |= 0x00000001; } result.appId_ = appId_; result.uploadKeyType_ = uploadKeyType_; result.dataSourceType_ = dataSourceType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof com.google.ads.googleads.v12.common.CrmBasedUserListInfo) { return mergeFrom((com.google.ads.googleads.v12.common.CrmBasedUserListInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(com.google.ads.googleads.v12.common.CrmBasedUserListInfo other) { if (other == com.google.ads.googleads.v12.common.CrmBasedUserListInfo.getDefaultInstance()) return this; if (other.hasAppId()) { bitField0_ |= 0x00000001; appId_ = other.appId_; onChanged(); } if (other.uploadKeyType_ != 0) { setUploadKeyTypeValue(other.getUploadKeyTypeValue()); } if (other.dataSourceType_ != 0) { setDataSourceTypeValue(other.getDataSourceTypeValue()); } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 16: { uploadKeyType_ = input.readEnum(); break; } // case 16 case 24: { dataSourceType_ = input.readEnum(); break; } // case 24 case 34: { appId_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000001; break; } // case 34 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { done = true; // was an endgroup tag } break; } // default: } // switch (tag) } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.unwrapIOException(); } finally { onChanged(); } // finally return this; } private int bitField0_; private java.lang.Object appId_ = ""; /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @return Whether the appId field is set. */ public boolean hasAppId() { return ((bitField0_ & 0x00000001) != 0); } /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @return The appId. */ public java.lang.String getAppId() { java.lang.Object ref = appId_; if (!(ref instanceof java.lang.String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); appId_ = s; return s; } else { return (java.lang.String) ref; } } /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @return The bytes for appId. */ public com.google.protobuf.ByteString getAppIdBytes() { java.lang.Object ref = appId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @param value The appId to set. * @return This builder for chaining. */ public Builder setAppId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; appId_ = value; onChanged(); return this; } /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @return This builder for chaining. */ public Builder clearAppId() { bitField0_ = (bitField0_ & ~0x00000001); appId_ = getDefaultInstance().getAppId(); onChanged(); return this; } /** * <pre> * A string that uniquely identifies a mobile application from which the data * was collected. * For iOS, the ID string is the 9 digit string that appears at the end of an * App Store URL (for example, "476943146" for "Flood-It! 2" whose App Store * link is http://itunes.apple.com/us/app/flood-it!-2/id476943146). For * Android, the ID string is the application's package name (for example, * "com.labpixies.colordrips" for "Color Drips" given Google Play link * https://play.google.com/store/apps/details?id=com.labpixies.colordrips). * Required when creating CrmBasedUserList for uploading mobile advertising * IDs. * </pre> * * <code>optional string app_id = 4;</code> * @param value The bytes for appId to set. * @return This builder for chaining. */ public Builder setAppIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); bitField0_ |= 0x00000001; appId_ = value; onChanged(); return this; } private int uploadKeyType_ = 0; /** * <pre> * Matching key type of the list. * Mixed data types are not allowed on the same list. * This field is required for an ADD operation. * </pre> * * <code>.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType upload_key_type = 2;</code> * @return The enum numeric value on the wire for uploadKeyType. */ @java.lang.Override public int getUploadKeyTypeValue() { return uploadKeyType_; } /** * <pre> * Matching key type of the list. * Mixed data types are not allowed on the same list. * This field is required for an ADD operation. * </pre> * * <code>.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType upload_key_type = 2;</code> * @param value The enum numeric value on the wire for uploadKeyType to set. * @return This builder for chaining. */ public Builder setUploadKeyTypeValue(int value) { uploadKeyType_ = value; onChanged(); return this; } /** * <pre> * Matching key type of the list. * Mixed data types are not allowed on the same list. * This field is required for an ADD operation. * </pre> * * <code>.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType upload_key_type = 2;</code> * @return The uploadKeyType. */ @java.lang.Override public com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType getUploadKeyType() { @SuppressWarnings("deprecation") com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType result = com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType.valueOf(uploadKeyType_); return result == null ? com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType.UNRECOGNIZED : result; } /** * <pre> * Matching key type of the list. * Mixed data types are not allowed on the same list. * This field is required for an ADD operation. * </pre> * * <code>.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType upload_key_type = 2;</code> * @param value The uploadKeyType to set. * @return This builder for chaining. */ public Builder setUploadKeyType(com.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType value) { if (value == null) { throw new NullPointerException(); } uploadKeyType_ = value.getNumber(); onChanged(); return this; } /** * <pre> * Matching key type of the list. * Mixed data types are not allowed on the same list. * This field is required for an ADD operation. * </pre> * * <code>.google.ads.googleads.v12.enums.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType upload_key_type = 2;</code> * @return This builder for chaining. */ public Builder clearUploadKeyType() { uploadKeyType_ = 0; onChanged(); return this; } private int dataSourceType_ = 0; /** * <pre> * Data source of the list. Default value is FIRST_PARTY. * Only customers on the allow-list can create third-party sourced CRM lists. * </pre> * * <code>.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType data_source_type = 3;</code> * @return The enum numeric value on the wire for dataSourceType. */ @java.lang.Override public int getDataSourceTypeValue() { return dataSourceType_; } /** * <pre> * Data source of the list. Default value is FIRST_PARTY. * Only customers on the allow-list can create third-party sourced CRM lists. * </pre> * * <code>.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType data_source_type = 3;</code> * @param value The enum numeric value on the wire for dataSourceType to set. * @return This builder for chaining. */ public Builder setDataSourceTypeValue(int value) { dataSourceType_ = value; onChanged(); return this; } /** * <pre> * Data source of the list. Default value is FIRST_PARTY. * Only customers on the allow-list can create third-party sourced CRM lists. * </pre> * * <code>.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType data_source_type = 3;</code> * @return The dataSourceType. */ @java.lang.Override public com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType getDataSourceType() { @SuppressWarnings("deprecation") com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType result = com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType.valueOf(dataSourceType_); return result == null ? com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType.UNRECOGNIZED : result; } /** * <pre> * Data source of the list. Default value is FIRST_PARTY. * Only customers on the allow-list can create third-party sourced CRM lists. * </pre> * * <code>.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType data_source_type = 3;</code> * @param value The dataSourceType to set. * @return This builder for chaining. */ public Builder setDataSourceType(com.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType value) { if (value == null) { throw new NullPointerException(); } dataSourceType_ = value.getNumber(); onChanged(); return this; } /** * <pre> * Data source of the list. Default value is FIRST_PARTY. * Only customers on the allow-list can create third-party sourced CRM lists. * </pre> * * <code>.google.ads.googleads.v12.enums.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType data_source_type = 3;</code> * @return This builder for chaining. */ public Builder clearDataSourceType() { dataSourceType_ = 0; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:google.ads.googleads.v12.common.CrmBasedUserListInfo) } // @@protoc_insertion_point(class_scope:google.ads.googleads.v12.common.CrmBasedUserListInfo) private static final com.google.ads.googleads.v12.common.CrmBasedUserListInfo DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new com.google.ads.googleads.v12.common.CrmBasedUserListInfo(); } public static com.google.ads.googleads.v12.common.CrmBasedUserListInfo getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<CrmBasedUserListInfo> PARSER = new com.google.protobuf.AbstractParser<CrmBasedUserListInfo>() { @java.lang.Override public CrmBasedUserListInfo parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { Builder builder = newBuilder(); try { builder.mergeFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(builder.buildPartial()); } catch (com.google.protobuf.UninitializedMessageException e) { throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException(e) .setUnfinishedMessage(builder.buildPartial()); } return builder.buildPartial(); } }; public static com.google.protobuf.Parser<CrmBasedUserListInfo> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<CrmBasedUserListInfo> getParserForType() { return PARSER; } @java.lang.Override public com.google.ads.googleads.v12.common.CrmBasedUserListInfo getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
{ "content_hash": "b1ee61a43b978261336f3192f24f95af", "timestamp": "", "source": "github", "line_count": 959, "max_line_length": 225, "avg_line_length": 39.06986444212722, "alnum_prop": 0.6890680046973418, "repo_name": "googleads/google-ads-java", "id": "01b8327a2b5c7a81af2720cfd3165e9f2980f7cd", "size": "37468", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "google-ads-stubs-v12/src/main/java/com/google/ads/googleads/v12/common/CrmBasedUserListInfo.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "28701198" } ], "symlink_target": "" }
set -e # give up after two minutes TIMEOUT=120 # # functions # . /usr/share/one/supervisor/scripts/lib/functions.sh # # run service # #TODO: should I wait for sunstone or something? for envfile in \ /etc/one/guacd \ ; do if [ -f "$envfile" ] ; then . "$envfile" fi done LD_LIBRARY_PATH=/usr/share/one/guacd/lib export LD_LIBRARY_PATH msg "Service started!" exec /usr/share/one/guacd/sbin/guacd -f $OPTS
{ "content_hash": "dd6b3b2087c6ab8283e84794a996759f", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 52, "avg_line_length": 14.03225806451613, "alnum_prop": 0.6597701149425287, "repo_name": "OpenNebula/one", "id": "d87b58eac4b69ccdea4b4a59f4e0563d355fa8fc", "size": "446", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "share/pkgs/services/supervisor/centos8/scripts/opennebula-guacd.sh", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Augeas", "bytes": "5809" }, { "name": "C", "bytes": "1582926" }, { "name": "C++", "bytes": "4972435" }, { "name": "CSS", "bytes": "77624" }, { "name": "Go", "bytes": "449317" }, { "name": "HTML", "bytes": "48493" }, { "name": "Handlebars", "bytes": "850880" }, { "name": "Java", "bytes": "517105" }, { "name": "JavaScript", "bytes": "6983132" }, { "name": "Jinja", "bytes": "3712" }, { "name": "Lex", "bytes": "10999" }, { "name": "Makefile", "bytes": "2832" }, { "name": "Python", "bytes": "199809" }, { "name": "Roff", "bytes": "2086" }, { "name": "Ruby", "bytes": "4919604" }, { "name": "SCSS", "bytes": "44872" }, { "name": "Shell", "bytes": "1116349" }, { "name": "Yacc", "bytes": "35951" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/textView3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:gravity="center" android:padding="8dp" android:text="Small Text" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_toLeftOf="@+id/imageView2" android:layout_toStartOf="@+id/imageView2" android:textStyle="bold" /> <View android:background="#666666" android:layout_width="match_parent" android:layout_height="1dp" android:layout_alignBottom="@+id/textView3" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView2" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:src="@drawable/ic_action_right" android:layout_alignBottom="@+id/textView3" android:layout_alignParentTop="true" android:padding="8dp" /> </RelativeLayout>
{ "content_hash": "a1f18636ec88fb74bfcc0e6b8a620083", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 74, "avg_line_length": 37.111111111111114, "alnum_prop": 0.6601796407185628, "repo_name": "RadiationX/4pdaClient-plus", "id": "5e235fea8aa021e41143e01e70020260ca4ffe8d", "size": "1336", "binary": false, "copies": "1", "ref": "refs/heads/beta", "path": "app/src/main/res/layout/forum_header_current_item.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1320148" }, { "name": "HTML", "bytes": "926" }, { "name": "Java", "bytes": "1995408" }, { "name": "JavaScript", "bytes": "318578" } ], "symlink_target": "" }
from django.conf import settings from django.core.files import File from django.core.files.storage import Storage from django.core.exceptions import ImproperlyConfigured from django.utils.deconstruct import deconstructible from django.utils.six import BytesIO from django.utils.six.moves.urllib import parse as urlparse try: import pyodbc except ImportError: raise ImproperlyConfigured("Could not load pyodbc dependency.\ \nSee https://github.com/mkleehammer/pyodbc") REQUIRED_FIELDS = ('db_table', 'fname_column', 'blob_column', 'size_column', 'base_url') @deconstructible class DatabaseStorage(Storage): """ Class DatabaseStorage provides storing files in the database. """ def __init__(self, option=settings.DB_FILES): """Constructor. Constructs object using dictionary either specified in contucotr or in settings.DB_FILES. @param option dictionary with 'db_table', 'fname_column', 'blob_column', 'size_column', 'base_url' keys. option['db_table'] Table to work with. option['fname_column'] Column in the 'db_table' containing filenames (filenames can contain pathes). Values should be the same as where FileField keeps filenames. It is used to map filename to blob_column. In sql it's simply used in where clause. option['blob_column'] Blob column (for example 'image' type), created manually in the 'db_table', used to store image. option['size_column'] Column to store file size. Used for optimization of size() method (another way is to open file and get size) option['base_url'] Url prefix used with filenames. Should be mapped to the view, that returns an image as result. """ if not option or not all([field in option for field in REQUIRED_FIELDS]): raise ValueError("You didn't specify required options") self.db_table = option['db_table'] self.fname_column = option['fname_column'] self.blob_column = option['blob_column'] self.size_column = option['size_column'] self.base_url = option['base_url'] #get database settings self.DATABASE_ODBC_DRIVER = settings.DATABASE_ODBC_DRIVER self.DATABASE_NAME = settings.DATABASE_NAME self.DATABASE_USER = settings.DATABASE_USER self.DATABASE_PASSWORD = settings.DATABASE_PASSWORD self.DATABASE_HOST = settings.DATABASE_HOST self.connection = pyodbc.connect('DRIVER=%s;SERVER=%s;DATABASE=%s;UID=%s;PWD=%s'%(self.DATABASE_ODBC_DRIVER,self.DATABASE_HOST,self.DATABASE_NAME, self.DATABASE_USER, self.DATABASE_PASSWORD) ) self.cursor = self.connection.cursor() def _open(self, name, mode='rb'): """Open a file from database. @param name filename or relative path to file based on base_url. path should contain only "/", but not "\". Apache sends pathes with "/". If there is no such file in the db, returs None """ assert mode == 'rb', "You've tried to open binary file without specifying binary mode! You specified: %s"%mode row = self.cursor.execute("SELECT %s from %s where %s = '%s'"%(self.blob_column,self.db_table,self.fname_column,name) ).fetchone() if row is None: return None inMemFile = BytesIO(row[0]) inMemFile.name = name inMemFile.mode = mode retFile = File(inMemFile) return retFile def _save(self, name, content): """Save 'content' as file named 'name'. @note '\' in path will be converted to '/'. """ name = name.replace('\\', '/') binary = pyodbc.Binary(content.read()) size = len(binary) #todo: check result and do something (exception?) if failed. if self.exists(name): self.cursor.execute("UPDATE %s SET %s = ?, %s = ? WHERE %s = '%s'"%(self.db_table,self.blob_column,self.size_column,self.fname_column,name), (binary, size) ) else: self.cursor.execute("INSERT INTO %s VALUES(?, ?, ?)"%(self.db_table), (name, binary, size) ) self.connection.commit() return name def exists(self, name): row = self.cursor.execute("SELECT %s from %s where %s = '%s'"%(self.fname_column,self.db_table,self.fname_column,name)).fetchone() return row is not None def get_available_name(self, name, max_length=None): return name def delete(self, name): if self.exists(name): self.cursor.execute("DELETE FROM %s WHERE %s = '%s'"%(self.db_table,self.fname_column,name)) self.connection.commit() def url(self, name): if self.base_url is None: raise ValueError("This file is not accessible via a URL.") return urlparse.urljoin(self.base_url, name).replace('\\', '/') def size(self, name): row = self.cursor.execute("SELECT %s from %s where %s = '%s'"%(self.size_column,self.db_table,self.fname_column,name)).fetchone() if row is None: return 0 else: return int(row[0])
{ "content_hash": "f9711e0e5415df14ae9712b82b3eaffc", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 154, "avg_line_length": 39.68939393939394, "alnum_prop": 0.626646306547051, "repo_name": "ZuluPro/django-storages", "id": "0f4669a81163d0f60d5cdb83f58d358f6a9cf629", "size": "5316", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "storages/backends/database.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "150922" } ], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>generic::basic_endpoint::resize</title> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../../boost_asio.html" title="Boost.Asio"> <link rel="up" href="../generic__basic_endpoint.html" title="generic::basic_endpoint"> <link rel="prev" href="protocol_type.html" title="generic::basic_endpoint::protocol_type"> <link rel="next" href="size.html" title="generic::basic_endpoint::size"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="protocol_type.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../generic__basic_endpoint.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="size.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> <a name="boost_asio.reference.generic__basic_endpoint.resize"></a><a class="link" href="resize.html" title="generic::basic_endpoint::resize">generic::basic_endpoint::resize</a> </h4></div></div></div> <p> <a class="indexterm" name="idp72660960"></a> Set the underlying size of the endpoint in the native type. </p> <pre class="programlisting"><span class="keyword">void</span> <span class="identifier">resize</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">new_size</span><span class="special">);</span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2015 Christopher M. Kohlhoff<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="protocol_type.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../generic__basic_endpoint.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="size.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "651b2e43509d8455eb2f7743be6c8470", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 438, "avg_line_length": 66.21153846153847, "alnum_prop": 0.6314260819053151, "repo_name": "calvinfarias/IC2015-2", "id": "46d5549c58c8a12e0ad610876c33d1826fb9970c", "size": "3443", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "BOOST/boost_1_61_0/libs/asio/doc/html/boost_asio/reference/generic__basic_endpoint/resize.html", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "223360" }, { "name": "Batchfile", "bytes": "32233" }, { "name": "C", "bytes": "2977162" }, { "name": "C#", "bytes": "40804" }, { "name": "C++", "bytes": "184445796" }, { "name": "CMake", "bytes": "119765" }, { "name": "CSS", "bytes": "427923" }, { "name": "Cuda", "bytes": "111870" }, { "name": "DIGITAL Command Language", "bytes": "6246" }, { "name": "FORTRAN", "bytes": "5291" }, { "name": "Groff", "bytes": "5189" }, { "name": "HTML", "bytes": "234946752" }, { "name": "IDL", "bytes": "14" }, { "name": "JavaScript", "bytes": "682223" }, { "name": "Lex", "bytes": "1231" }, { "name": "M4", "bytes": "29689" }, { "name": "Makefile", "bytes": "1083443" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "11406" }, { "name": "Objective-C++", "bytes": "630" }, { "name": "PHP", "bytes": "59030" }, { "name": "Perl", "bytes": "39008" }, { "name": "Perl6", "bytes": "2053" }, { "name": "Python", "bytes": "1759984" }, { "name": "QML", "bytes": "593" }, { "name": "QMake", "bytes": "16692" }, { "name": "Rebol", "bytes": "354" }, { "name": "Ruby", "bytes": "5532" }, { "name": "Shell", "bytes": "355247" }, { "name": "Tcl", "bytes": "1172" }, { "name": "TeX", "bytes": "126042" }, { "name": "XSLT", "bytes": "552736" }, { "name": "Yacc", "bytes": "19623" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_32) on Tue Jun 18 11:08:52 PDT 2013 --> <TITLE> IdentityVerificationAttributes (AWS SDK for Java - 1.4.7) </TITLE> <META NAME="date" CONTENT="2013-06-18"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../JavaDoc.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="IdentityVerificationAttributes (AWS SDK for Java - 1.4.7)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <span id="feedback_section"><h3>Did this page help you?</h3>&nbsp;&nbsp;&nbsp;<a id="feedback_yes" target="_blank">Yes</a>&nbsp;&nbsp;&nbsp;<a id="feedback_no" target="_blank">No</a>&nbsp;&nbsp;&nbsp;<a id="go_cti" target="_blank">Tell us about it...</a></span> <script type="text/javascript"> var javadoc_root_name = "/javadoc/"; var javadoc_path = location.href.substring(0, location.href.lastIndexOf(javadoc_root_name) + javadoc_root_name.length); var file_path = location.href.substring(location.href.lastIndexOf(javadoc_root_name) + javadoc_root_name.length); var feedback_yes_url = javadoc_path + "javadoc-resources/feedbackyes.html?topic_id="; var feedback_no_url = javadoc_path + "javadoc-resources/feedbackno.html?topic_id="; var feedback_tellmore_url = "https://aws-portal.amazon.com/gp/aws/html-forms-controller/documentation/aws_doc_feedback_04?service_name=Java-Ref&file_name="; if(file_path != "overview-frame.html") { var file_name = file_path.replace(/[/.]/g, '_'); document.getElementById("feedback_yes").setAttribute("href", feedback_yes_url + file_name); document.getElementById("feedback_no").setAttribute("href", feedback_no_url + file_name); document.getElementById("go_cti").setAttribute("href", feedback_tellmore_url + file_name); } else { // hide the header in overview-frame page document.getElementById("feedback_section").innerHTML = ""; } </script> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityType.html" title="enum in com.amazonaws.services.simpleemail.model"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../com/amazonaws/services/simpleemail/model/ListIdentitiesRequest.html" title="class in com.amazonaws.services.simpleemail.model"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="IdentityVerificationAttributes.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.amazonaws.services.simpleemail.model</FONT> <BR> Class IdentityVerificationAttributes</H2> <PRE> <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>com.amazonaws.services.simpleemail.model.IdentityVerificationAttributes</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</A></DD> </DL> <HR> <DL> <DT><PRE>public class <B>IdentityVerificationAttributes</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A><DT>implements <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</A></DL> </PRE> <P> <p> Represents the verification attributes of a single identity. </p> <P> <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../../../serialized-form.html#com.amazonaws.services.simpleemail.model.IdentityVerificationAttributes">Serialized Form</A></DL> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#IdentityVerificationAttributes()">IdentityVerificationAttributes</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#equals(java.lang.Object)">equals</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;obj)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#getVerificationStatus()">getVerificationStatus</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#getVerificationToken()">getVerificationToken</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification token for a domain identity.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#hashCode()">hashCode</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#setVerificationStatus(java.lang.String)">setVerificationStatus</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationStatus)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#setVerificationStatus(com.amazonaws.services.simpleemail.model.VerificationStatus)">setVerificationStatus</A></B>(<A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model">VerificationStatus</A>&nbsp;verificationStatus)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#setVerificationToken(java.lang.String)">setVerificationToken</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationToken)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification token for a domain identity.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#toString()">toString</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a string representation of this object; useful for testing and debugging.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" title="class in com.amazonaws.services.simpleemail.model">IdentityVerificationAttributes</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#withVerificationStatus(java.lang.String)">withVerificationStatus</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationStatus)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" title="class in com.amazonaws.services.simpleemail.model">IdentityVerificationAttributes</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#withVerificationStatus(com.amazonaws.services.simpleemail.model.VerificationStatus)">withVerificationStatus</A></B>(<A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model">VerificationStatus</A>&nbsp;verificationStatus)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" title="class in com.amazonaws.services.simpleemail.model">IdentityVerificationAttributes</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html#withVerificationToken(java.lang.String)">withVerificationToken</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationToken)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The verification token for a domain identity.</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="IdentityVerificationAttributes()"><!-- --></A><H3> IdentityVerificationAttributes</H3> <PRE> public <B>IdentityVerificationAttributes</B>()</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="getVerificationStatus()"><!-- --></A><H3> getVerificationStatus</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getVerificationStatus</B>()</PRE> <DL> <DD>The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure". <p> <b>Constraints:</b><br/> <b>Allowed Values: </b>Pending, Success, Failed, TemporaryFailure <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".<DT><B>See Also:</B><DD><A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model"><CODE>VerificationStatus</CODE></A></DL> </DD> </DL> <HR> <A NAME="setVerificationStatus(java.lang.String)"><!-- --></A><H3> setVerificationStatus</H3> <PRE> public void <B>setVerificationStatus</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationStatus)</PRE> <DL> <DD>The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure". <p> <b>Constraints:</b><br/> <b>Allowed Values: </b>Pending, Success, Failed, TemporaryFailure <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>verificationStatus</CODE> - The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".<DT><B>See Also:</B><DD><A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model"><CODE>VerificationStatus</CODE></A></DL> </DD> </DL> <HR> <A NAME="withVerificationStatus(java.lang.String)"><!-- --></A><H3> withVerificationStatus</H3> <PRE> public <A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" title="class in com.amazonaws.services.simpleemail.model">IdentityVerificationAttributes</A> <B>withVerificationStatus</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationStatus)</PRE> <DL> <DD>The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure". <p> Returns a reference to this object so that method calls can be chained together. <p> <b>Constraints:</b><br/> <b>Allowed Values: </b>Pending, Success, Failed, TemporaryFailure <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>verificationStatus</CODE> - The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure". <DT><B>Returns:</B><DD>A reference to this updated object so that method calls can be chained together.<DT><B>See Also:</B><DD><A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model"><CODE>VerificationStatus</CODE></A></DL> </DD> </DL> <HR> <A NAME="setVerificationStatus(com.amazonaws.services.simpleemail.model.VerificationStatus)"><!-- --></A><H3> setVerificationStatus</H3> <PRE> public void <B>setVerificationStatus</B>(<A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model">VerificationStatus</A>&nbsp;verificationStatus)</PRE> <DL> <DD>The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure". <p> <b>Constraints:</b><br/> <b>Allowed Values: </b>Pending, Success, Failed, TemporaryFailure <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>verificationStatus</CODE> - The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure".<DT><B>See Also:</B><DD><A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model"><CODE>VerificationStatus</CODE></A></DL> </DD> </DL> <HR> <A NAME="withVerificationStatus(com.amazonaws.services.simpleemail.model.VerificationStatus)"><!-- --></A><H3> withVerificationStatus</H3> <PRE> public <A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" title="class in com.amazonaws.services.simpleemail.model">IdentityVerificationAttributes</A> <B>withVerificationStatus</B>(<A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model">VerificationStatus</A>&nbsp;verificationStatus)</PRE> <DL> <DD>The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure". <p> Returns a reference to this object so that method calls can be chained together. <p> <b>Constraints:</b><br/> <b>Allowed Values: </b>Pending, Success, Failed, TemporaryFailure <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>verificationStatus</CODE> - The verification status of the identity: "Pending", "Success", "Failed", or "TemporaryFailure". <DT><B>Returns:</B><DD>A reference to this updated object so that method calls can be chained together.<DT><B>See Also:</B><DD><A HREF="../../../../../com/amazonaws/services/simpleemail/model/VerificationStatus.html" title="enum in com.amazonaws.services.simpleemail.model"><CODE>VerificationStatus</CODE></A></DL> </DD> </DL> <HR> <A NAME="getVerificationToken()"><!-- --></A><H3> getVerificationToken</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getVerificationToken</B>()</PRE> <DL> <DD>The verification token for a domain identity. Null for email address identities. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The verification token for a domain identity. Null for email address identities.</DL> </DD> </DL> <HR> <A NAME="setVerificationToken(java.lang.String)"><!-- --></A><H3> setVerificationToken</H3> <PRE> public void <B>setVerificationToken</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationToken)</PRE> <DL> <DD>The verification token for a domain identity. Null for email address identities. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>verificationToken</CODE> - The verification token for a domain identity. Null for email address identities.</DL> </DD> </DL> <HR> <A NAME="withVerificationToken(java.lang.String)"><!-- --></A><H3> withVerificationToken</H3> <PRE> public <A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" title="class in com.amazonaws.services.simpleemail.model">IdentityVerificationAttributes</A> <B>withVerificationToken</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;verificationToken)</PRE> <DL> <DD>The verification token for a domain identity. Null for email address identities. <p> Returns a reference to this object so that method calls can be chained together. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>verificationToken</CODE> - The verification token for a domain identity. Null for email address identities. <DT><B>Returns:</B><DD>A reference to this updated object so that method calls can be chained together.</DL> </DD> </DL> <HR> <A NAME="toString()"><!-- --></A><H3> toString</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE> <DL> <DD>Returns a string representation of this object; useful for testing and debugging. <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>A string representation of this object.<DT><B>See Also:</B><DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang"><CODE>Object.toString()</CODE></A></DL> </DD> </DL> <HR> <A NAME="hashCode()"><!-- --></A><H3> hashCode</H3> <PRE> public int <B>hashCode</B>()</PRE> <DL> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="equals(java.lang.Object)"><!-- --></A><H3> equals</H3> <PRE> public boolean <B>equals</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A>&nbsp;obj)</PRE> <DL> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <script src="http://aws.amazon.com/js/urchin.js" type="text/javascript"></script> <script type="text/javascript">urchinTracker();</script> <!-- SiteCatalyst code version: H.25.2. Copyright 1996-2012 Adobe, Inc. All Rights Reserved. More info available at http://www.omniture.com --> <script language="JavaScript" type="text/javascript" src="https://d36cz9buwru1tt.cloudfront.net/js/sitecatalyst/s_code.min.js (view-source:https://d36cz9buwru1tt.cloudfront.net/js/sitecatalyst/s_code.min.js)" /> <script language="JavaScript" type="text/javascript"> <!-- // Documentation Service Name s.prop66='AWS SDK for Java'; s.eVar66='D=c66'; // Documentation Guide Name s.prop65='API Reference'; s.eVar65='D=c65'; var s_code=s.t();if(s_code)document.write(s_code) //--> </script> <script language="JavaScript" type="text/javascript"> <!--if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-') //--> </script> <noscript> <img src="http://amazonwebservices.d2.sc.omtrdc.net/b/ss/awsamazondev/1/H.25.2--NS/0" height="1" width="1" border="0" alt="" /> </noscript> <!--/DO NOT REMOVE/--> <!-- End SiteCatalyst code version: H.25.2. --> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../com/amazonaws/services/simpleemail/model/IdentityType.html" title="enum in com.amazonaws.services.simpleemail.model"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../com/amazonaws/services/simpleemail/model/ListIdentitiesRequest.html" title="class in com.amazonaws.services.simpleemail.model"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="IdentityVerificationAttributes.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 2010 Amazon Web Services, Inc. All Rights Reserved. </BODY> </HTML>
{ "content_hash": "ca67245c47485e3064d7b9a2aaec8c26", "timestamp": "", "source": "github", "line_count": 605, "max_line_length": 931, "avg_line_length": 52.02479338842975, "alnum_prop": 0.6687847498014297, "repo_name": "hobinyoon/aws-java-sdk-1.4.7", "id": "411cda61a46751d4fd945fb227efd4358a1fb16c", "size": "31475", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "documentation/javadoc/com/amazonaws/services/simpleemail/model/IdentityVerificationAttributes.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
require 'test_helper' class ShortUrlsShowTest < ActionDispatch::IntegrationTest def setup @admin = users(:cthulhu) @short_url = short_urls(:hits_test) log_in_as(@admin) end test 'shows slug as heading' do get short_url_path(@short_url) assert_select 'h2', @short_url.slug end test 'shows edit and delete buttons' do get short_url_path(@short_url) assert_select 'a[href=?]', edit_short_url_path(@short_url) assert_select 'a[href=?]', delete_short_url_path(@short_url) end test 'shows stats' do get short_url_path(@short_url) assert_select 'div.short-url-stats', 1 assert_select 'div.short-url-stat', 2 assert_select 'span.stat-gloss', 2 assert_select 'span.stat-entry', 2 end end
{ "content_hash": "91a4bfff3989811d1c26477fc66fddc2", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 64, "avg_line_length": 26.821428571428573, "alnum_prop": 0.6711051930758988, "repo_name": "flyinggrizzly/url-grey", "id": "732f8dd8f22c6cbbfe3d4c8e838eed9a6ebf3fe3", "size": "751", "binary": false, "copies": "1", "ref": "refs/heads/staging", "path": "test/integration/short_urls_show_test.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "22578" }, { "name": "CoffeeScript", "bytes": "1055" }, { "name": "HTML", "bytes": "17841" }, { "name": "JavaScript", "bytes": "1201" }, { "name": "Ruby", "bytes": "98045" }, { "name": "Shell", "bytes": "28" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>KnockbackNavigators.js Interactive Tests</title> <link rel="stylesheet" href="vendor/normalize.css"> <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"> <link rel="stylesheet" href="../knockback-navigators.css"> </head> <body> <a class='btn' href='../index.html#page_navigator_panes' style='position: absolute; z-index: 200'>More Examples</a> <div kb-inject="AppViewModel"> <!-- VIEWS --> <div class='pane' id='main'> <div class='hero-unit'> <a href='#page1' class='btn btn-warning btn-small'>Page1</a> <h1>Main</h1> </div> </div> <div class='pane' id='page1'> <div class='hero-unit'> <a href='#' class='btn btn-small'><i class='icon-step-backward'></i><span> Back</span></a> <a href='#page2' class='btn btn-warning btn-small'>Page2</a> <h1>Page1</h1> </div> </div> <div class='pane' id='page2'> <div class='hero-unit'> <a href='#page1' class='btn btn-small'><i class='icon-step-backward'></i><span> Back</span></a> <h1>Page2</h1> </div> </div> </div> <script src="vendor/xui-2.3.2.js"></script> <script src="vendor/path-0.8.4.js"></script> <script src="vendor/knockback-core-stack-0.18.1.js"></script> <script src="../knockback-page-navigator-panes.js"></script> <script type='text/javascript'> var AppViewModel = function(vm, el) { //////////////////////////////////// // Page Routing and Navigating // Don't allow pages to be detached since they are owned by the DOM (default is to assume dynamic pages and to therefore detach) //////////////////////////////////// var page_navigator = new kb.PageNavigatorPanes(el, {no_remove: true}); Path.map('').to(page_navigator.dispatcher(function(){ page_navigator.loadPage($(el).find('#main')[0]); })); Path.map('#page1').to(page_navigator.dispatcher(function(){ page_navigator.loadPage($(el).find('#page1')[0]); })); Path.map('#page2').to(page_navigator.dispatcher(function(){ page_navigator.loadPage($(el).find('#page2')[0]); })); Path.listen(); // start routing after the ViewModel is bound (and the elements have been generated) this.afterBinding = function() { Path.dispatch(window.location.hash); }; }; </script> <!-- ****************** --> <!-- Source --> <!-- ****************** --> <script src="vendor/backbone/underscore-1.5.2.js"></script> <script type='text/javascript'> var el = $('<div><h1>Example Source</h1><pre>' +_.escape(document.body.innerHTML.substring(0, document.body.innerHTML.indexOf('<!-- ****************** -->')))+'</pre></div>')[0]; $('body')[0].appendChild(el); </script> </body> </html>
{ "content_hash": "86958385b1b431224316ca99bccc9f62", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 182, "avg_line_length": 38.14102564102564, "alnum_prop": 0.5845378151260504, "repo_name": "kmalakoff/knockback-navigators", "id": "87e00a0c77654425b1d312145e3e91a54e35c052", "size": "2975", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "examples/pnp-nt-i_xui_pth_kb.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "36884" }, { "name": "CoffeeScript", "bytes": "53122" }, { "name": "JavaScript", "bytes": "57903" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>msets-extra: 43 s 🏆</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.9.0 / msets-extra - 1.2.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> msets-extra <small> 1.2.0 <span class="label label-success">43 s 🏆</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-05-12 14:23:30 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-05-12 14:23:30 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 2 Virtual package relying on perl coq 8.9.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.06.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.06.1 Official 4.06.1 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.3 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;thomas@tuerk-brechen.de&quot; homepage: &quot;https://github.com/thtuerk/MSetsExtra&quot; dev-repo: &quot;git+https://github.com/thtuerk/MSetsExtra.git&quot; bug-reports: &quot;https://github.com/thtuerk/MSetsExtra/issues&quot; authors: [&quot;FireEye Formal Methods Team &lt;formal-methods@fireeye.com&gt;&quot; &quot;Thomas Tuerk &lt;thomas@tuerk-brechen.de&gt;&quot;] license: &quot;LGPL-2.1-only&quot; build: [ [&quot;./configure.sh&quot;] [make &quot;-j%{jobs}%&quot;] ] install: [ [make &quot;install&quot;] ] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.9&quot; &amp; &lt; &quot;8.10~&quot;} &quot;coq-mathcomp-ssreflect&quot; {&gt;= &quot;1.6&quot;} ] tags: [ &quot;keyword:finite sets&quot; &quot;keyword:fold with abort&quot; &quot;keyword:extracting efficient code&quot; &quot;keyword:data structures&quot; &quot;category:Computer Science/Data Types and Data Structures&quot; &quot;category:Miscellaneous/Extracted Programs/Data structures&quot; &quot;logpath:MSetsExtra&quot; &quot;date:2019-09-19&quot; ] synopsis: &quot;Extensions of MSets for Efficient Execution&quot; description: &quot;&quot;&quot; Coq&#39;s MSet library provides various, reasonably efficient finite set implementations. Nevertheless, FireEye was struggling with performance issues. This library contains extensions to Coq&#39;s MSet library that helped the FireEye Formal Methods team (formal-methods@fireeye.com), solve these performance issues. There are - Fold With Abort efficient folding with possibility to start late and stop early - Interval Sets a memory efficient representation of sets of numbers - Unsorted Lists with Duplicates&quot;&quot;&quot; url { src: &quot;https://github.com/thtuerk/MSetsExtra/archive/1.2.0.tar.gz&quot; checksum: &quot;sha256=e886237194cde8602dbf191d3db7b1c28c6231c1c42996ca1b1819db3ab339ef&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-msets-extra.1.2.0 coq.8.9.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-msets-extra.1.2.0 coq.8.9.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>2 m 14 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-msets-extra.1.2.0 coq.8.9.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>43 s</dd> </dl> <h2>Installation size</h2> <p>Total: 14 M</p> <ul> <li>12 M <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetIntervals.vo</code></li> <li>1 M <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetFoldWithAbort.vo</code></li> <li>839 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetIntervals.glob</code></li> <li>194 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetListWithDups.vo</code></li> <li>171 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetIntervals.v</code></li> <li>146 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetFoldWithAbort.glob</code></li> <li>82 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetListWithDups.glob</code></li> <li>48 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetWithDups.vo</code></li> <li>42 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetFoldWithAbort.v</code></li> <li>22 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetWithDups.glob</code></li> <li>22 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetListWithDups.v</code></li> <li>7 K <code>../ocaml-base-compiler.4.06.1/lib/coq/user-contrib/MSetsExtra/MSetWithDups.v</code></li> </ul> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-msets-extra.1.2.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "bdd3daae2260f6d2d3d228b84a1e877e", "timestamp": "", "source": "github", "line_count": 190, "max_line_length": 159, "avg_line_length": 46.98947368421052, "alnum_prop": 0.5740367383512545, "repo_name": "coq-bench/coq-bench.github.io", "id": "c57bc7fa2fe60a426c568a4fb4193ad28b4b7c39", "size": "8953", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.06.1-2.0.5/released/8.9.0/msets-extra/1.2.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
using System.Collections.Generic; using System.ComponentModel.Composition; using AgentMulder.ReSharper.Domain.Patterns; using AgentMulder.ReSharper.Domain.Registrations; using JetBrains.ReSharper.Feature.Services.CSharp.StructuralSearch; using JetBrains.ReSharper.Feature.Services.CSharp.StructuralSearch.Placeholders; using JetBrains.ReSharper.Feature.Services.StructuralSearch; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; namespace AgentMulder.Containers.Ninject.Patterns.Bind.To { [Export(typeof(ComponentImplementationPatternBase))] public class ToSelf : ComponentImplementationPatternBase { private static readonly IStructuralSearchPattern pattern = new CSharpStructuralSearchPattern("$bind$.ToSelf()", new ExpressionPlaceholder("bind", "global::Ninject.Syntax.IBindingSyntax", false)); public ToSelf() : base(pattern, "bind") { } public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement) { IStructuralMatchResult match = Match(registrationRootElement); if (match.Matched) { var invocationExpression = match.GetMatchedElement("bind") as IInvocationExpression; if (invocationExpression == null) { yield break; } IDeclaredType declaredType = GetDeclaredType(invocationExpression); if (declaredType != null) { ITypeElement typeElement = declaredType.GetTypeElement(); if (typeElement != null) { yield return new ComponentRegistration(registrationRootElement, typeElement); } } } } private IDeclaredType GetDeclaredType(IInvocationExpression invocationExpression) { if (invocationExpression.TypeArguments.Count > 0) { return invocationExpression.TypeArguments[0].GetScalarType(); } if (invocationExpression.ArgumentList.Arguments.Count > 0) { var typeOfExpression = invocationExpression.ArgumentList.Arguments[0].Value as ITypeofExpression; if (typeOfExpression == null) { return null; } return typeOfExpression.ArgumentType.GetScalarType(); } return null; } } }
{ "content_hash": "42514dfa0e7bbf5876f50969c8dac9c8", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 120, "avg_line_length": 37.056338028169016, "alnum_prop": 0.6263778031166857, "repo_name": "hmemcpy/AgentMulder", "id": "a5fbb9b8618b0f174a5a4be610e863bcd8ffdeff", "size": "2633", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/AgentMulder.Containers.Ninject/Patterns/Bind/To/ToSelf.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "644" }, { "name": "C#", "bytes": "423339" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>T813029780060864512</title> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600"> <link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/custom.css"> <link rel="shortcut icon" href="https://micro.blog/curt/favicon.png" type="image/x-icon" /> <link rel="alternate" type="application/rss+xml" title="Curt Clifton" href="http://microblog.curtclifton.net/feed.xml" /> <link rel="alternate" type="application/json" title="Curt Clifton" href="http://microblog.curtclifton.net/feed.json" /> <link rel="EditURI" type="application/rsd+xml" href="/rsd.xml" /> <link rel="me" href="https://micro.blog/curt" /> <link rel="me" href="https://twitter.com/curtclifton" /> <link rel="authorization_endpoint" href="https://micro.blog/indieauth/auth" /> <link rel="token_endpoint" href="https://micro.blog/indieauth/token" /> <link rel="micropub" href="https://micro.blog/micropub" /> <link rel="webmention" href="https://micro.blog/webmention" /> <link rel="subscribe" href="https://micro.blog/users/follow" /> </head> <body> <div class="container"> <header class="masthead"> <h1 class="masthead-title--small"> <a href="/">Curt Clifton</a> </h1> </header> <div class="content post h-entry"> <div class="post-date"> <time class="dt-published" datetime="2016-12-25 06:32:59 -0800">25 Dec 2016</time> </div> <div class="e-content"> <p>A merry Clifton Christmas. <a href="https://t.co/4fKELiyQ81">https://t.co/4fKELiyQ81</a></p> </div> </div> </div> </body> </html>
{ "content_hash": "a5d1082d643e7ca71e30da28fb63450e", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 123, "avg_line_length": 34.56, "alnum_prop": 0.6655092592592593, "repo_name": "curtclifton/curtclifton.github.io", "id": "8cedd124b38c87ae6ba9cf3fa24ce3f0a8236f4f", "size": "1728", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_site/2016/12/25/t813029780060864512.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "9029" }, { "name": "HTML", "bytes": "3523910" } ], "symlink_target": "" }
package org.jboss.weld.tests.contexts.weld1159; import java.net.SocketTimeoutException; import java.net.URL; import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.weld.test.util.Utils; import org.jboss.weld.tests.category.Integration; import org.junit.After; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import com.gargoylesoftware.htmlunit.WebClient; /** * * Reproduces deadlock between creation locks in the application and session context. * * Two pairs of beans are constructed in parallel: * * SessionScopedFoo -> ApplicationScopedFoo * ApplicationScopedBar -> SessionScopedBar * * We use a {@link CountDownLatch} to simulate that both threads get into state when the first bean of the pair * (SessionScopedFoo and ApplicationScopedFoo) is created and before the dependency is created. This causes deadlock * because the first thread * * - owns the session lock * - waits for application lock * * whereas the second thread * * - owns the application lock * - waits for the session lock * * @author Jozef Hartinger * */ @RunWith(Arquillian.class) @Category(Integration.class) public class ContextDeadlockTest { @ArquillianResource private volatile URL url; private final WebClient client = new WebClient(); private final ExecutorService executor = Executors.newCachedThreadPool(); @Deployment(testable = false) public static Archive<?> getDeployment() { return ShrinkWrap.create(WebArchive.class, Utils.getDeploymentNameAsHash(ContextDeadlockTest.class, Utils.ARCHIVE_TYPE.WAR)) .addClasses(AbstractBean.class, ApplicationScopedFoo.class, ApplicationScopedBar.class, SessionScopedFoo.class, SessionScopedBar.class, TestServlet.class) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } @Test public void test() throws Exception { client.setTimeout(15000); List<Callable<Void>> requests = new LinkedList<Callable<Void>>(); requests.add(new ConcurrentRequest(url.toString() + "/foo")); requests.add(new ConcurrentRequest(url.toString() + "/bar")); for (Future<Void> result : executor.invokeAll(requests)) { result.get(); } } @After public void shutdown() { executor.shutdownNow(); } private class ConcurrentRequest implements Callable<Void> { private final String url; public ConcurrentRequest(String url) { this.url = url; } public Void call() throws Exception { try { client.getPage(url); } catch (SocketTimeoutException e) { throw new RuntimeException("The request for " + url + " timed out. It is very likely that a deadlock occured."); } return null; } } }
{ "content_hash": "e24359f0e1be90558e88abee3ddf10f2", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 151, "avg_line_length": 32.148148148148145, "alnum_prop": 0.709389400921659, "repo_name": "antoinesd/weld-core", "id": "e0e635fb387eea684b20731d9abf4ff9426870c2", "size": "4247", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/weld1159/ContextDeadlockTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "5226" }, { "name": "Groovy", "bytes": "7775" }, { "name": "HTML", "bytes": "97201" }, { "name": "Java", "bytes": "9987377" }, { "name": "JavaScript", "bytes": "184606" } ], "symlink_target": "" }
package csc612mcaseproject.models.objects; /** * Created by user on 11/29/2015. */ public class PipelineMapInstruction { String instructionAddress; String instruction; String opcodeHex; Integer ifCycleNumber; Integer idCycleNumber; Integer exCycleNumber; Integer memCycleNumber; Integer wbCycleNumber; public PipelineMapInstruction(String instructionAddress, String instruction, String opcodeHex) { this.instructionAddress = instructionAddress; this.instruction = instruction; this.opcodeHex = opcodeHex; } /** * Gets instruction. * * @return Value of instruction. */ public String getInstruction() { return instruction; } /** * Gets OpcodeHex. * * @return Value of OpcodeHex. */ public String getOpcodeHex() { return opcodeHex; } /** * Sets new OpcodeHex. * * @param opcodeHex New value of OpcodeHex. */ public void setOpcodeHex(String opcodeHex) { this.opcodeHex = opcodeHex; } /** * Gets instructionAddress. * * @return Value of instructionAddress. */ public String getInstructionAddress() { return instructionAddress; } /** * Sets new instruction. * * @param instruction New value of instruction. */ public void setInstruction(String instruction) { this.instruction = instruction; } /** * Sets new instructionAddress. * * @param instructionAddress New value of instructionAddress. */ public void setInstructionAddress(String instructionAddress) { this.instructionAddress = instructionAddress; } /** * Gets exCycleNumber. * * @return Value of exCycleNumber. */ public Integer getExCycleNumber() { return exCycleNumber; } /** * Sets new wbCycleNumber. * * @param wbCycleNumber New value of wbCycleNumber. */ public void setWbCycleNumber(Integer wbCycleNumber) { this.wbCycleNumber = wbCycleNumber; } /** * Gets ifCycleNumber. * * @return Value of ifCycleNumber. */ public Integer getIfCycleNumber() { return ifCycleNumber; } /** * Gets idCycleNumber. * * @return Value of idCycleNumber. */ public Integer getIdCycleNumber() { return idCycleNumber; } /** * Sets new memCycleNumber. * * @param memCycleNumber New value of memCycleNumber. */ public void setMemCycleNumber(Integer memCycleNumber) { this.memCycleNumber = memCycleNumber; } /** * Sets new exCycleNumber. * * @param exCycleNumber New value of exCycleNumber. */ public void setExCycleNumber(Integer exCycleNumber) { this.exCycleNumber = exCycleNumber; } /** * Sets new idCycleNumber. * * @param idCycleNumber New value of idCycleNumber. */ public void setIdCycleNumber(Integer idCycleNumber) { this.idCycleNumber = idCycleNumber; } /** * Gets wbCycleNumber. * * @return Value of wbCycleNumber. */ public Integer getWbCycleNumber() { return wbCycleNumber; } /** * Sets new ifCycleNumber. * * @param ifCycleNumber New value of ifCycleNumber. */ public void setIfCycleNumber(Integer ifCycleNumber) { this.ifCycleNumber = ifCycleNumber; } /** * Gets memCycleNumber. * * @return Value of memCycleNumber. */ public Integer getMemCycleNumber() { return memCycleNumber; } }
{ "content_hash": "54f6a1b7df590421bc01a7e3a5c05a70", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 100, "avg_line_length": 22, "alnum_prop": 0.6136363636363636, "repo_name": "SharmaineLim/MIPSCaseProject", "id": "16c97ec13b7a0af67dee2716cc2e80c454f45c5d", "size": "3652", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/csc612mcaseproject/models/objects/PipelineMapInstruction.java", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "982" }, { "name": "Java", "bytes": "115194" } ], "symlink_target": "" }
<?php class watchProjectTestCaseHelper extends WatchmanTestCase { function runProjectTests($tests, $touch_watchmanconfig = false) { foreach ($tests as $info) { list($touch, $expected_watch, $expect_rel, $expected_pass) = $info; $dir = PhutilDirectoryFixture::newEmptyFixture(); $root = realpath($dir->getPath()); mkdir("$root/a/b/c", 0777, true); touch("$root/$touch"); if ($touch_watchmanconfig) { touch("$root/.watchmanconfig"); } $res = $this->watchProject("$root/a/b/c"); $err = idx($res, 'error'); // Dump some info to make it easier to diagnose failures $label = json_encode($info) . " res=" . json_encode($res); if ($expected_watch === null) { $full_watch = $root; } else { $full_watch = "$root/$expected_watch"; } if ($expected_pass) { if ($err) { $this->assertFailure("failed to watch-project: $err"); } $this->assertEqual($full_watch, idx($res, 'watch'), $label); $this->assertEqual($expect_rel, idx($res, 'relative_path'), $label); } else { if ($err) { $this->assertEqual( "resolve_projpath: none of the files listed in global config ". "root_files are present in path `$root/a/b/c` or any ". "of its parent directories", $err, $label); } else { $this->assertFailure("didn't expect watch-project success $label"); } } } } } class watchProjectTestCase extends watchProjectTestCaseHelper { function getGlobalConfig() { return array( 'root_files' => array('.git', '.hg', '.foo', '.bar') ); } function testWatchProject() { $this->runProjectTests(array( array("a/b/c/.git", "a/b/c", NULL, true), array("a/b/.hg", "a/b", "c", true), array("a/.foo", "a", "b/c", true), array(".bar", NULL, "a/b/c", true), array("a/.bar", "a", "b/c", true), array(".svn", "a/b/c", NULL, true), array("a/baz", "a/b/c", NULL, true), )); } function testWatchProjectWatchmanConfig() { $this->runProjectTests(array( array("a/b/c/.git", NULL, "a/b/c", true), array("a/b/.hg", NULL, "a/b/c", true), array("a/.foo", NULL, "a/b/c", true), array(".bar", NULL, "a/b/c", true), array("a/.bar", NULL, "a/b/c", true), array(".svn", NULL, "a/b/c", true), array("a/baz", NULL, "a/b/c", true), ), true); } function testReuseNestedWatch() { $dir = PhutilDirectoryFixture::newEmptyFixture(); $root = realpath($dir->getPath()); mkdir("$root/a/b/c", 0777, true); touch("$root/a/b/c/.watchmanconfig"); $res = $this->watchProject($root); $this->assertEqual($root, idx($res, 'watch')); $res = $this->watchProject("$root/a/b/c"); $this->assertEqual($root, idx($res, 'watch'), 'watch other root'); $this->assertEqual('a/b/c', idx($res, 'relative_path'), 'should re-use other watch'); } } class watchProjectEnforcingTestCase extends watchProjectTestCaseHelper { function getGlobalConfig() { return array( 'root_files' => array('.git', '.hg', '.foo', '.bar'), 'enforce_root_files' => true, ); } function testWatchProjectEnforcing() { $this->runProjectTests(array( array("a/b/c/.git", "a/b/c", NULL, true), array("a/b/.hg", "a/b", "c", true), array("a/.foo", "a", "b/c", true), array(".bar", NULL, "a/b/c", true), array("a/.bar", "a", "b/c", true), array(".svn", NULL, NULL, false), array("a/baz", NULL, NULL, false), )); } }
{ "content_hash": "86115a1a2e918144275af0b1eeb76bcc", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 77, "avg_line_length": 31.37391304347826, "alnum_prop": 0.5507206208425721, "repo_name": "exponentjs/watchman", "id": "bb5fc4f8383d88fa6b1a9d7cecf8652f95544bd8", "size": "3701", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/integration/watchproject.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "423495" }, { "name": "CSS", "bytes": "13675" }, { "name": "JavaScript", "bytes": "81076" }, { "name": "PHP", "bytes": "164546" }, { "name": "Python", "bytes": "46391" }, { "name": "Ruby", "bytes": "16364" }, { "name": "Shell", "bytes": "3526" } ], "symlink_target": "" }
package domain.company.vaisabrina; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; /** * Created by emiliano on 7/21/17. */ public class GaleriaActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.galeria); ViewPager gallery = (ViewPager) findViewById(R.id.gallery); GaleriaAlunoAdapter adapter = new GaleriaAlunoAdapter(new AlunoDAO(this).getLista(), this); gallery.setAdapter(adapter); } }
{ "content_hash": "4ccdde6519fb25b70d00b5b31c7d95ab", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 99, "avg_line_length": 32.333333333333336, "alnum_prop": 0.7452135493372607, "repo_name": "emilianoeloi/androido", "id": "0ab9e9ba387357b7a00cc138fe4b8bce82c95ec5", "size": "679", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/domain/company/vaisabrina/GaleriaActivity.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "44166" }, { "name": "Makefile", "bytes": "62" } ], "symlink_target": "" }
<!-- Unsafe sample input : get the UserData field of $_SESSION SANITIZE : use of preg_replace File : use of untrusted data in a double quoted property value (CSS) --> <!--Copyright 2015 Bertrand STIVALET Permission is hereby granted, without written agreement or royalty fee, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following three paragraphs appear in all copies of this software. IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.--> <!DOCTYPE html> <html> <head> <style> <?php $tainted = $_SESSION['UserData']; $tainted = preg_replace('/\'/', '', $tainted); //flaw echo "body { color :\"". $tainted ."\" ; }" ; ?> </style> </head> <body> <h1>Hello World!</h1> </body> </html>
{ "content_hash": "8c388c7ae8161c876c4010173478a6b6", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 75, "avg_line_length": 22.45762711864407, "alnum_prop": 0.7411320754716981, "repo_name": "stivalet/PHP-Vulnerability-test-suite", "id": "4cf97dbf402168739e6adbf9945e7f000555ee12", "size": "1325", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "XSS/CWE_79/unsafe/CWE_79__SESSION__func_preg_replace__Use_untrusted_data_propertyValue_CSS-double_Quoted_Property_Value.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "64184004" } ], "symlink_target": "" }
package edu.uci.ics.fuzzyjoin.hadoop; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.Partitioner; public class IntPairPartitionerFirst<V> implements Partitioner<IntPairWritable, V> { public void configure(JobConf job) { } public int getPartition(IntPairWritable key, V value, int numPartitions) { return key.getFirst() % numPartitions; } }
{ "content_hash": "c049a9387d38b9a7838978c8a931193a", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 78, "avg_line_length": 22.5, "alnum_prop": 0.7283950617283951, "repo_name": "TonyApuzzo/fuzzyjoin", "id": "6fb8305c6f693587ec1bfcb33bf105da8e0cd63d", "size": "1096", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "fuzzyjoin-hadoop/src/main/java/edu/uci/ics/fuzzyjoin/hadoop/IntPairPartitionerFirst.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "6230" }, { "name": "Java", "bytes": "462352" }, { "name": "Python", "bytes": "55247" }, { "name": "Shell", "bytes": "65771" }, { "name": "XSLT", "bytes": "1070" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using DTcms.API.OAuth; using DTcms.Common; namespace DTcms.Web.api.oauth.renren { public partial class return_url : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //取得返回参数 string state = DTRequest.GetQueryString("state"); string code = DTRequest.GetQueryString("code"); string access_token = string.Empty; string expires_in = string.Empty; string openid = string.Empty; if (Session["oauth_state"] == null || Session["oauth_state"].ToString() == "" || state != Session["oauth_state"].ToString()) { Response.Write("出错啦,state未初始化!"); return; } if (string.IsNullOrEmpty(code)) { Response.Write("授权被取消,相关信息:" + DTRequest.GetQueryString("error")); return; } //获取Access Token Dictionary<string,object> dic = renren_helper.get_access_token(code); if (dic == null) { Response.Write("错误代码:,无法获取Access Token,请检查App Key是否正确!"); } access_token = dic["access_token"].ToString(); expires_in = dic["expires_in"].ToString(); Dictionary<string, object> dic1 = dic["user"] as Dictionary<string, object>; openid = dic1["id"].ToString(); //储存获取数据用到的信息 Session["oauth_name"] = "renren"; Session["oauth_access_token"] = access_token; Session["oauth_openid"] = openid; //跳转到指定页面 Response.Redirect(new Web.UI.BasePage().linkurl("oauth_login")); return; } } }
{ "content_hash": "9c9adf36dac1a0e8c8afb85c988552df", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 136, "avg_line_length": 33, "alnum_prop": 0.5486443381180224, "repo_name": "LutherW/MWMS", "id": "75a05fb6e37b2d5b35db0883f1be75bd08b43792", "size": "2013", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Source/DTcms.Web/api/oauth/renren/return_url.aspx.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "1907954" }, { "name": "C#", "bytes": "3098946" }, { "name": "CSS", "bytes": "479025" }, { "name": "HTML", "bytes": "440127" }, { "name": "JavaScript", "bytes": "1376460" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_45) on Tue Apr 17 08:42:03 IDT 2018 --> <title>com.exlibris.digitool.common.streams</title> <meta name="date" content="2018-04-17"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="com.exlibris.digitool.common.streams"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../com/exlibris/digitool/common/storage/package-summary.html">Prev&nbsp;Package</a></li> <li><a href="../../../../../com/exlibris/digitool/infrastructure/utils/package-summary.html">Next&nbsp;Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/exlibris/digitool/common/streams/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Package" class="title">Package&nbsp;com.exlibris.digitool.common.streams</h1> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation"> <caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Class</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../../com/exlibris/digitool/common/streams/ScriptUtil.html" title="class in com.exlibris.digitool.common.streams">ScriptUtil</a></td> <td class="colLast"> <div class="block">ScriptUtil - enables executing scripts from within a Java plug-in</div> </td> </tr> </tbody> </table> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../com/exlibris/digitool/common/storage/package-summary.html">Prev&nbsp;Package</a></li> <li><a href="../../../../../com/exlibris/digitool/infrastructure/utils/package-summary.html">Next&nbsp;Package</a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/exlibris/digitool/common/streams/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "9a6f569c2685ba07f38a0af6d05e14b5", "timestamp": "", "source": "github", "line_count": 142, "max_line_length": 172, "avg_line_length": 35.605633802816904, "alnum_prop": 0.6220332278481012, "repo_name": "ExLibrisGroup/Rosetta.dps-sdk-projects", "id": "4ec4495013895eefc01c8cf16afae942d48346f2", "size": "5056", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "5.5.0/javadoc/com/exlibris/digitool/common/streams/package-summary.html", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "4697410" }, { "name": "Shell", "bytes": "297" } ], "symlink_target": "" }
.element-rotate-90deg { -moz-transform: rotate(90deg); -webkit-transform: rotate(90deg); -o-transform: rotate(90deg); -ms-transform: rotate(90deg); transform: rotate(90deg); transition: 0.2s; } .element-rotate-180deg { -moz-transform: rotate(180deg); -webkit-transform: rotate(180deg); -o-transform: rotate(180deg); -ms-transform: rotate(180deg); transform: rotate(180deg); transition: 0.2s; } .element-default { -moz-transform: rotate(0deg); -webkit-transform: rotate(0deg); -o-transform: rotate(0deg); -ms-transform: rotate(0deg); transform: rotate(0deg); transition: 0.2s; }
{ "content_hash": "8ef898a8870b37b3d5e9a47e5f3922f3", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 38, "avg_line_length": 25.076923076923077, "alnum_prop": 0.6533742331288344, "repo_name": "crazymousethief/jquery-markview", "id": "05393b90722dd92bb67da18f3a0a6ac0f1cd89ee", "size": "652", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/css/element.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13148" }, { "name": "HTML", "bytes": "1322" }, { "name": "JavaScript", "bytes": "9758" } ], "symlink_target": "" }
<?php namespace Installer; use Composer\Script\Event; use Installer\Handlers\CleanerHandler; use Installer\Handlers\ParametersHandler; class Scripts { /** * @param Event $event */ public static function postCreateProjectCmd(Event $event) { self::runHandler($event, new ParametersHandler()); self::runHandler($event, new CleanerHandler()); } /** * @param Event $event * @param Handlers\HandlerInterface $handler */ private static function runHandler(Event $event, Handlers\HandlerInterface $handler) { $handler->setEvent($event)->execute(); } }
{ "content_hash": "cfbb091440dd4677ee63acb41a7fb63f", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 88, "avg_line_length": 22.428571428571427, "alnum_prop": 0.6624203821656051, "repo_name": "Edwin-Luijten/mini-symfony", "id": "a15e4838461c691c48a2bc185bddcfce80b18991", "size": "628", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "installer/Scripts.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "12164" }, { "name": "HTML", "bytes": "120516" }, { "name": "PHP", "bytes": "10937" } ], "symlink_target": "" }
import flatten from './flatten'; /** * A composition of map and flatten. * * Works like map, in that it maps a function over a sequence, * but flattens one level of nested arrays, so that each mapping * can lend multiple results, but still result in a flat list. * * @this Array * @param {Function} fn * @return {Array} */ export default function flatMap(fn) { return this.map(fn)::flatten(); }
{ "content_hash": "14ff74aff96a87b950f4c8eb757d96e2", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 64, "avg_line_length": 24.352941176470587, "alnum_prop": 0.678743961352657, "repo_name": "zenoamaro/webpage-transcriber", "id": "076cdc66b5ac9160fab52803efad92634816b3a6", "size": "414", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/utils/flatMap.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "605419" }, { "name": "JavaScript", "bytes": "855702" }, { "name": "Makefile", "bytes": "1411" } ], "symlink_target": "" }
const common = require('../common') module.exports = function slowRead(opts) { opts = opts || {} var threshold = +opts.threshold || 1000 var chunkSize = (+opts.chunk || +opts.bps) || 1024 return function slowRead(req, res, next) { var buf = [] var ended = false var closed = false var _push = Object.getPrototypeOf(req).push if (isInvalidMethod(req)) return next() // Handle client close connection properly req.on('close', cleanup) res.on('close', cleanup) // Wrap native http.IncomingMessage method req.push = function (data, encoding) { if (data === null) return writeChunks() common.sliceBuffer(chunkSize, data, encoding, buf) } function writeChunks() { if (ended) return ended = true common.eachSeries(buf, pushDefer, end) } function end() { if (closed) return cleanup() req.push(null) } function pushDefer(chunk, next) { setTimeout(function () { if (closed) return next('closed') _push.call(req, chunk.buffer, chunk.encoding) next() }, threshold) } function cleanup() { if (closed) return closed = true // Restore and clean references req.push = _push _push = buf = null // Clean listeners to prevent leaks req.removeListener('close', cleanup) res.removeListener('close', cleanup) } next() } } function isInvalidMethod(req) { return !~['POST', 'PUT', 'DELETE', 'PATCH'].indexOf(req.method) }
{ "content_hash": "449f71617b50be989d8fb55aef5948a8", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 65, "avg_line_length": 23.272727272727273, "alnum_prop": 0.603515625, "repo_name": "nwwells/toxy", "id": "39c2e1847442daa9241ca58d5717cbb6212644e1", "size": "1539", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/poisons/slow-read.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "50232" } ], "symlink_target": "" }
import sys def trace_exceptions(frame, event, arg): if event != 'exception': return co = frame.f_code func_name = co.co_name line_no = frame.f_lineno exc_type, exc_value, exc_traceback = arg print(('* Tracing exception:\n' '* {} "{}"\n' '* on line {} of {}\n').format( exc_type.__name__, exc_value, line_no, func_name)) def trace_calls(frame, event, arg): if event != 'call': return co = frame.f_code func_name = co.co_name if func_name in TRACE_INTO: return trace_exceptions def c(): raise RuntimeError('generating exception in c()') def b(): c() print('Leaving b()') def a(): b() print('Leaving a()') TRACE_INTO = ['a', 'b', 'c'] sys.settrace(trace_calls) try: a() except Exception as e: print('Exception handler:', e)
{ "content_hash": "f7735acbe44e48c023473e41f40632b7", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 53, "avg_line_length": 18.3125, "alnum_prop": 0.5437997724687145, "repo_name": "jasonwee/asus-rt-n14uhp-mrtg", "id": "28d206c0ada968f2d8279c0184f44f1a418757bf", "size": "880", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/lesson_runtime_features/sys_settrace_exception.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "45876" }, { "name": "HTML", "bytes": "107072" }, { "name": "JavaScript", "bytes": "161335" }, { "name": "Python", "bytes": "6923750" }, { "name": "Shell", "bytes": "7616" } ], "symlink_target": "" }
import { Component, ElementRef, forwardRef, Inject, Injector, OnInit, ViewEncapsulation } from '@angular/core'; import { Router } from '@angular/router'; import { Util } from '../../../util/util'; import { OBarMenuComponent } from '../o-bar-menu.component'; import { DEFAULT_INPUTS_O_BASE_MENU_ITEM, OBaseMenuItemClass } from '../o-base-menu-item.class'; export const DEFAULT_INPUTS_O_BAR_MENU_ITEM = [ ...DEFAULT_INPUTS_O_BASE_MENU_ITEM, // route [string]: name of the state to navigate. Default: no value. 'route', // action [function]: function to execute. Default: no value. 'action' ]; @Component({ selector: 'o-bar-menu-item', templateUrl: './o-bar-menu-item.component.html', styleUrls: ['./o-bar-menu-item.component.scss'], inputs: DEFAULT_INPUTS_O_BAR_MENU_ITEM, encapsulation: ViewEncapsulation.None, host: { '[class.o-bar-menu-item]': 'true', '[attr.disabled]': 'disabled' } }) export class OBarMenuItemComponent extends OBaseMenuItemClass implements OnInit { protected router: Router; route: string; action: () => void; constructor( @Inject(forwardRef(() => OBarMenuComponent)) protected menu: OBarMenuComponent, protected elRef: ElementRef, protected injector: Injector ) { super(menu, elRef, injector); this.router = this.injector.get(Router); } ngOnInit() { // if (typeof (this.route) === 'string') { // // TODO, permisos por route? // } else { // this.restricted = false; // } super.ngOnInit(); } collapseMenu(evt: Event) { if (this.menu) { this.menu.collapseAll(); } } onClick() { if (this.disabled) { return; } if (Util.isDefined(this.route)) { this.router.navigate([this.route]); } else if (Util.isDefined(this.action)) { this.action(); } } }
{ "content_hash": "9093572dcf67949069ec080a53dcf38c", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 111, "avg_line_length": 26.852941176470587, "alnum_prop": 0.6429353778751369, "repo_name": "OntimizeWeb/ontimize-web-ng2", "id": "a5bd1fd01a2cb0589df058587fe265a2d4468cd0", "size": "1826", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "projects/ontimize-web-ngx/src/lib/components/bar-menu/menu-item/o-bar-menu-item.component.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "52457" }, { "name": "HTML", "bytes": "43931" }, { "name": "JavaScript", "bytes": "20344" }, { "name": "TypeScript", "bytes": "383178" } ], "symlink_target": "" }
PY?=python3 PELICAN?=pelican PELICANOPTS= BASEDIR=$(CURDIR) INPUTDIR=$(BASEDIR)/content OUTPUTDIR=$(BASEDIR)/site CONFFILE=$(BASEDIR)/pelicanconf.py PUBLISHCONF=$(BASEDIR)/publishconf.py FTP_HOST=localhost FTP_USER=anonymous FTP_TARGET_DIR=/ SSH_HOST=localhost SSH_PORT=22 SSH_USER=root SSH_TARGET_DIR=/var/www S3_BUCKET=my_s3_bucket CLOUDFILES_USERNAME=my_rackspace_username CLOUDFILES_API_KEY=my_rackspace_api_key CLOUDFILES_CONTAINER=my_cloudfiles_container DROPBOX_DIR=~/Dropbox/Public/ GITHUB_PAGES_BRANCH=master DEBUG ?= 0 ifeq ($(DEBUG), 1) PELICANOPTS += -D endif RELATIVE ?= 0 ifeq ($(RELATIVE), 1) PELICANOPTS += --relative-urls endif help: @echo 'Makefile for a pelican Web site ' @echo ' ' @echo 'Usage: ' @echo ' make html (re)generate the web site ' @echo ' make clean remove the generated files ' @echo ' make regenerate regenerate files upon modification ' @echo ' make publish generate using production settings ' @echo ' make serve [PORT=8000] serve site at http://localhost:8000' @echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 ' @echo ' make devserver [PORT=8000] start/restart develop_server.sh ' @echo ' make stopserver stop local server ' @echo ' make ssh_upload upload the web site via SSH ' @echo ' make rsync_upload upload the web site via rsync+ssh ' @echo ' make dropbox_upload upload the web site via Dropbox ' @echo ' make ftp_upload upload the web site via FTP ' @echo ' make s3_upload upload the web site via S3 ' @echo ' make cf_upload upload the web site via Cloud Files' @echo ' make github upload the web site via gh-pages ' @echo ' ' @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html ' @echo 'Set the RELATIVE variable to 1 to enable relative urls ' @echo ' ' html: $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) clean: [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) regenerate: $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) serve: ifdef PORT cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT) else cd $(OUTPUTDIR) && $(PY) -m pelican.server endif serve-global: ifdef SERVER cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER) else cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0 endif devserver: ifdef PORT $(BASEDIR)/develop_server.sh restart $(PORT) else $(BASEDIR)/develop_server.sh restart endif stopserver: $(BASEDIR)/develop_server.sh stop @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.' publish: $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS) ssh_upload: publish scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) rsync_upload: publish rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude dropbox_upload: publish cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR) ftp_upload: publish lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit" s3_upload: publish s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed --guess-mime-type --no-mime-magic --no-preserve cf_upload: publish cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) . github: publish ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR) git push origin $(GITHUB_PAGES_BRANCH) .PHONY: html help clean regenerate serve serve-global devserver stopserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
{ "content_hash": "66fa5b680aca566bbab8d46ebf68a73c", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 159, "avg_line_length": 35.21774193548387, "alnum_prop": 0.5928555072131898, "repo_name": "leetcraft/leetcraft.github.io", "id": "6fc0685769506bc58c40a9b6f9834ccd86a88fd6", "size": "4367", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Makefile", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "360896" }, { "name": "HTML", "bytes": "333425" }, { "name": "JavaScript", "bytes": "383287" }, { "name": "Jupyter Notebook", "bytes": "175159" }, { "name": "Makefile", "bytes": "4367" }, { "name": "Python", "bytes": "138411" }, { "name": "Shell", "bytes": "2338" }, { "name": "Smarty", "bytes": "4340" } ], "symlink_target": "" }
package com.hongtu.utils.stream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; /** * 流操作工具类 * Created by hongtu_zang on 2016/8/29. */ public class StreamUtil { /** * 从输入流中获取字符串 */ public static String getString(InputStream is) { StringBuilder sb = new StringBuilder(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String line; try { while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException e) { throw new RuntimeException(e); } return sb.toString(); } }
{ "content_hash": "803984dc3652a12704b4d06dd5c877d0", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 78, "avg_line_length": 23.966666666666665, "alnum_prop": 0.6022253129346314, "repo_name": "zanghongtu2006/ht_java_utils", "id": "cabd1c7ce55b701e30ab96e43378a1a8dcadb57d", "size": "751", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "common/src/main/java/com/hongtu/utils/stream/StreamUtil.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "8281" } ], "symlink_target": "" }
% Ryan Steindl based on Robotics Toolbox for MATLAB (v6 and v9) % % Copyright (C) 1993-2011, by Peter I. Corke % % This file is part of The Robotics Toolbox for MATLAB (RTB). % % RTB is free software: you can redistribute it and/or modify % it under the terms of the GNU Lesser General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % RTB 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 Lesser General Public License for more details. % % You should have received a copy of the GNU Leser General Public License % along with RTB. If not, see <http://www.gnu.org/licenses/>. % % http://www.petercorke.com function qp = mtimes(q1, q2) %Quaternion.mtimes Multiply a quaternion object % % Q1*Q2 is a quaternion formed by Hamilton product of two quaternions. % Q*V is the vector V rotated by the quaternion Q % Q*S is the element-wise multiplication of quaternion elements by by the scalar S if isa(q1, 'Quaternion') & isa(q2, 'Quaternion') %QQMUL Multiply unit-quaternion by unit-quaternion % % QQ = qqmul(Q1, Q2) % % Return a product of unit-quaternions. % % See also: TR2Q % decompose into scalar and vector components s1 = q1.s; v1 = q1.v; s2 = q2.s; v2 = q2.v; % form the product qp = Quaternion([s1*s2-v1*v2' s1*v2+s2*v1+cross(v1,v2)]); elseif isa(q1, 'Quaternion') & isa(q2, 'double') %QVMUL Multiply vector by unit-quaternion % % VT = qvmul(Q, V) % % Rotate the vector V by the unit-quaternion Q. % % See also: QQMUL, QINV if length(q2) == 3 qp = q1 * Quaternion([0 q2(:)']) * inv(q1); qp = qp.v(:); elseif length(q2) == 1 qp = Quaternion(double(q1)*q2); else error('quaternion-vector product: must be a 3-vector or scalar'); end elseif isa(q2, 'Quaternion') & isa(q1, 'double') if length(q1) == 3 qp = q2 * Quaternion([0 q1(:)']) * inv(q2); qp = qp.v; elseif length(q1) == 1 qp = Quaternion(double(q2)*q1); else error('quaternion-vector product: must be a 3-vector or scalar'); end end end
{ "content_hash": "35e67193c8700ca8f77d8f9b788b5005", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 86, "avg_line_length": 32.75675675675676, "alnum_prop": 0.6237623762376238, "repo_name": "queq/robot", "id": "e2b5b82c7dbe5e5ff96292b46a2f2a4e7465cd78", "size": "2424", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "robot-9.10/rvctools/robot/Octave/@Quaternion/mtimes.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "54863" }, { "name": "C++", "bytes": "56933" }, { "name": "HTML", "bytes": "802426" }, { "name": "Java", "bytes": "36049" }, { "name": "M", "bytes": "45" }, { "name": "Makefile", "bytes": "552" }, { "name": "Mathematica", "bytes": "465" }, { "name": "Matlab", "bytes": "2263327" }, { "name": "Mercury", "bytes": "201" } ], "symlink_target": "" }
(function() { $(document).ready(function() { $("#register-form #username").focus(function() { var firstname, lastname; firstname = $("#firstname").val(); lastname = $("#lastname").val(); if (firstname && lastname && !this.value) { return this.value = firstname + "." + lastname; } }); $("#register-form #title").css("position", "absolute").css("z-index", "-9999").chosen().show(); $("#register-form #url").bind("focus", function(e) { if ($.trim($(e.target).val()) === "") { return $(e.target).val("http://"); } }); $("#register-form #date").mask("99/99/9999"); $.validator.addMethod("chosen", (function(value, element) { if (value === 0) { return false; } else { if (value.length === 0) { return false; } else { return true; } } }), "Please select an option"); $.validator.addMethod("dateformat", (function(value, element) { return value.match(/^\d\d?\/\d\d?\/\d\d\d\d$/); }), "Please enter a date in the format mm/dd/yyyy"); return $("#register-form").validate({ errorElement: "span", errorPlacement: function(error, element) { error.appendTo(element.parents("div.controls")); error.addClass("help-block"); element.parents(".control-group").removeClass("success").addClass("error"); return element.parents(".control-group").find("a.chzn-single").addClass("error"); }, success: function(label) { label.parents(".control-group").removeClass("error"); return label.parents(".control-group").find("a.chzn-single").removeClass("error"); }, rules: { title: { required: true, min: 1, chosen: true }, firstname: { required: true, minlength: 2 }, lastname: { required: true, minlength: 2 }, username: { required: true, minlength: 2, maxlength: 10 }, password1: { required: true, minlength: 6, maxlength: 12 }, password2: { required: true, minlength: 6, equalTo: "#password1" }, email: { required: true, email: true }, date: { required: true, dateformat: true }, url: { required: true, url: true }, gender: { required: true }, agree: "required" }, messages: { title: { min: "Chose an option" }, gender: { min: "Chose an option" } }, submitHandler: function(form) { return $("#register-form #submit-button").button("loading"); } }); }); }).call(this);
{ "content_hash": "41871a8753d02f5345f516df3b6ffb27", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 99, "avg_line_length": 27.63809523809524, "alnum_prop": 0.48518263266712613, "repo_name": "billyct/sushe", "id": "1be0bc7e1256caed795d3255ea5e2d9693d45047", "size": "2902", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/js/form-stuff.validation.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "156435" }, { "name": "JavaScript", "bytes": "504004" }, { "name": "PHP", "bytes": "139622" } ], "symlink_target": "" }
var Joi = require('joi'); var log = require('server/helpers/logger'); var render = require('server/views/ticket'); var renderUsers = require('server/views/user'); var handlers = module.exports; exports.registerTicket = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'] }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), }, }, pre: [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'session.ticketsNeeded(pre.session)' }, { method: 'session.inRegistrationPeriod(pre.session)' }, { method: 'ticket.userRegistered(params.sessionId, auth.credentials.user.id)'}, { method: 'ticket.addUser(params.sessionId, auth.credentials.user.id, pre.session)', assign: 'ticket' }, { method: 'ticket.registrationEmail(pre.ticket, pre.session, auth.credentials.user)', failAction: 'log'} ], handler: function (request, reply) { reply(render(request.pre.ticket, request.pre.session)); }, description: 'Registers a ticket for the current user.', }; exports.voidTicket = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'] }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), }, }, pre: [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'session.ticketsNeeded(pre.session)' }, { method: 'ticket.get(params.sessionId)', assign: 'ticket'}, { method: 'ticket.removeUser(pre.session.id, auth.credentials.user.id, pre.session)', assign: 'removedTicket' }, { method: 'ticket.getAcceptedUser(pre.ticket, pre.session, auth.credentials.user)', assign: 'user', failAction: 'ignore'}, { method: 'ticket.registrationAcceptedEmail(pre.ticket, pre.session, pre.user)', failAction: 'ignore'} ], handler: function (request, reply) { reply(render(request.pre.removedTicket, request.pre.session)); }, description: 'Voids a ticket for the current user.', }; exports.confirmTicket = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'] }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), }, }, pre: [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'session.ticketsNeeded(pre.session)' }, { method: 'session.inConfirmationPeriod(pre.session)' }, { method: 'ticket.userConfirmed(params.sessionId, auth.credentials.user.id)'}, { method: 'ticket.confirmUser(params.sessionId, auth.credentials.user.id, pre.session)', assign: 'ticket' }, { method: 'ticket.confirmationEmail(pre.ticket, pre.session, auth.credentials.user)', failAction: 'log'} ], handler: function (request, reply) { reply(render(request.pre.ticket, request.pre.session)); }, description: 'Lets a user confirm that he is going on the day of the session.', }; exports.get = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'], mode: 'try' }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), } }, pre: [ [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'ticket.get(params.sessionId)', assign: 'ticket' } ] ], handler: function (request, reply) { reply(render(request.pre.ticket, request.pre.session)); }, description: 'Gets a ticket' }; exports.list = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user','admin'] }, validate: { query: { fields: Joi.string().description('Fields we want to retrieve'), sort: Joi.string().description('Sort fields we want to retrieve'), skip: Joi.number().description('Number of documents we want to skip'), limit: Joi.number().description('Limit of documents we want to retrieve') } }, pre: [ { method: 'ticket.list(query)', assign: 'tickets' } ], handler: function (request, reply) { reply(render(request.pre.tickets)); }, description: 'Gets all the tickets' }; exports.registerPresence = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['admin'] }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), userId: Joi.string().required().description('Id of the user'), }, }, pre: [ [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'ticket.registerUserPresence(params.sessionId, params.userId)', assign: 'ticket' } ] ], handler: function (request, reply) { reply(render(request.pre.ticket, request.pre.session)); }, description: 'Lets an admin confirm that the user showed up on the session.', }; exports.getUsers = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'], mode: 'try' }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), } }, pre: [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'ticket.getRegisteredUsers(params.sessionId, pre.session)', assign: 'userIds' }, { method: 'user.getMulti(pre.userIds)', assign: 'users' } ], handler: function (request, reply) { console.log(request.pre.userIds); reply(renderUsers(request.pre.users, request.auth.credentials && request.auth.credentials.user)); }, description: 'Gets the users' }; exports.getWaiting = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'], mode: 'try' }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), } }, pre: [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'ticket.getWaitingUsers(params.sessionId, pre.session)', assign: 'userIds' }, { method: 'user.getMulti(pre.userIds)', assign: 'users' } ], handler: function (request, reply) { console.log(request.pre.userIds); reply(renderUsers(request.pre.users, request.auth.credentials && request.auth.credentials.user)); }, description: 'Gets the waiting users' }; exports.getConfirmed = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'], mode: 'try' }, validate: { params: { sessionId: Joi.string().required().description('Id of the session'), } }, pre: [ { method: 'session.get(params.sessionId)', assign: 'session' }, { method: 'ticket.getConfirmedUsers(params.sessionId, pre.session)', assign: 'userIds' }, { method: 'user.getMulti(pre.userIds)', assign: 'users' } ], handler: function (request, reply) { console.log(request.pre.userIds); reply(renderUsers(request.pre.users, request.auth.credentials && request.auth.credentials.user)); }, description: 'Gets the confirmed users' }; exports.getUserSessions = { tags: ['api','ticket'], auth: { strategies: ['default', 'backup'], scope: ['user', 'admin'], mode: 'try' }, validate: { params: { userId: Joi.string().required().description('Id of the user'), } }, pre: [ { method: 'ticket.getUserSessions(params.userId)', assign: 'tickets' } ], handler: function (request, reply) { console.log(request.pre.tickets); reply(request.pre.tickets); }, description: 'Gets the sessions for a user' };
{ "content_hash": "66af9eb302d9a7503b91cf7b04e70f8b", "timestamp": "", "source": "github", "line_count": 258, "max_line_length": 126, "avg_line_length": 29.624031007751938, "alnum_prop": 0.6314274499542064, "repo_name": "xicombd/cannon-api", "id": "b9a2a5e9c13226f7bc6539c885c7edef38c690e5", "size": "7643", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/routes/ticket/handlers.js", "mode": "33188", "license": "mit", "language": [ { "name": "Handlebars", "bytes": "11033" }, { "name": "JavaScript", "bytes": "175708" } ], "symlink_target": "" }
namespace muduo { namespace net { class Channel; /// /// Base class for IO Multiplexing /// /// This class doesn't own the Channel objects. class Poller : noncopyable { public: typedef std::vector<Channel*> ChannelList; Poller(EventLoop* loop); virtual ~Poller(); /// Polls the I/O events. /// Must be called in the loop thread. virtual Timestamp poll(int timeoutMs, ChannelList* activeChannels) = 0; /// Changes the interested I/O events. /// Must be called in the loop thread. virtual void updateChannel(Channel* channel) = 0; /// Remove the channel, when it destructs. /// Must be called in the loop thread. virtual void removeChannel(Channel* channel) = 0; virtual bool hasChannel(Channel* channel) const; static Poller* newDefaultPoller(EventLoop* loop); void assertInLoopThread() const { ownerLoop_->assertInLoopThread(); } protected: typedef std::map<int, Channel*> ChannelMap; ChannelMap channels_; private: EventLoop* ownerLoop_; }; } // namespace net } // namespace muduo #endif // MUDUO_NET_POLLER_H
{ "content_hash": "7eb15b1fe32b63fb0d0de63ff5a5fe9a", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 73, "avg_line_length": 20.653846153846153, "alnum_prop": 0.6992551210428305, "repo_name": "westfly/muduo", "id": "089e60bef4f02cfe421a116a5475e2b2b42ecb85", "size": "1547", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "muduo/net/Poller.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C++", "bytes": "427184" }, { "name": "CMake", "bytes": "15798" }, { "name": "Lua", "bytes": "3678" }, { "name": "Protocol Buffer", "bytes": "1519" }, { "name": "Python", "bytes": "1068" }, { "name": "Shell", "bytes": "632" }, { "name": "Thrift", "bytes": "157" } ], "symlink_target": "" }
from airflow.contrib.hooks.cassandra_hook import CassandraHook from airflow.sensors.base_sensor_operator import BaseSensorOperator from airflow.utils.decorators import apply_defaults class CassandraRecordSensor(BaseSensorOperator): """ Checks for the existence of a record in a Cassandra cluster. For example, if you want to wait for a record that has values 'v1' and 'v2' for each primary keys 'p1' and 'p2' to be populated in keyspace 'k' and table 't', instantiate it as follows: >>> CassandraRecordSensor(table="k.t", keys={"p1": "v1", "p2": "v2"}, ... cassandra_conn_id="cassandra_default", task_id="cassandra_sensor") <Task(CassandraRecordSensor): cassandra_sensor> """ template_fields = ('table', 'keys') @apply_defaults def __init__(self, table, keys, cassandra_conn_id, *args, **kwargs): """ Create a new CassandraRecordSensor :param table: Target Cassandra table. Use dot notation to target a specific keyspace. :type table: string :param keys: The keys and their values to be monitored :type keys: dict :param cassandra_conn_id: The connection ID to use when connecting to Cassandra cluster :type cassandra_conn_id: string """ super(CassandraRecordSensor, self).__init__(*args, **kwargs) self.cassandra_conn_id = cassandra_conn_id self.table = table self.keys = keys def poke(self, context): self.log.info('Sensor check existence of record: %s', self.keys) hook = CassandraHook(self.cassandra_conn_id) return hook.record_exists(self.table, self.keys)
{ "content_hash": "090eb9338fa4f996863d531eedb42a7f", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 88, "avg_line_length": 40.69047619047619, "alnum_prop": 0.6512580456407255, "repo_name": "CloverHealth/airflow", "id": "aef66122e90c256683811e9be6b2f9d5f7f156f6", "size": "2520", "binary": false, "copies": "1", "ref": "refs/heads/clover", "path": "airflow/contrib/sensors/cassandra_sensor.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "109698" }, { "name": "Dockerfile", "bytes": "2001" }, { "name": "HTML", "bytes": "275682" }, { "name": "JavaScript", "bytes": "1988427" }, { "name": "Mako", "bytes": "1284" }, { "name": "Python", "bytes": "4085946" }, { "name": "Shell", "bytes": "47009" }, { "name": "TSQL", "bytes": "929" } ], "symlink_target": "" }
<?php namespace common\models; use yii\behaviors\TimestampBehavior; use yii\db\Expression; use Yii; /** * This is the model class for table "orders". * * @property string $id * @property string $activity_id * @property string $registered_to * @property integer $process_id * @property string $lang_code * @property string $loc_id * @property string $loc_id2 * @property integer $coverage * @property integer $coverage_within * @property string $delivery_starts * @property string $delivery_ends * @property string $delivery_time_operator * @property integer $consumer * @property integer $consumer_to * @property string $consumer_operator * @property integer $consumer_children * @property integer $frequency * @property string $frequency_unit * @property string $validity * @property string $budget * @property integer $currency_id * @property string $budget_operator * @property integer $shipping * @property integer $installation * @property integer $support * @property integer $turn_key * @property integer $tools * @property integer $phone_contact * @property string $title * @property string $note * @property integer $success * @property string $success_time * @property string $order_type * @property string $class * @property string $update_time * @property string $hit_counter * * @property CsLanguages $langCode * @property CsProcesses $process */ class Orders extends \yii\db\ActiveRecord { public $new_time = 0; public $service; public $new_user = 0; /** * @inheritdoc */ public static function tableName() { return 'orders'; } /** * @inheritdoc */ public function rules() { $service = $this->service; $loc_req = ['loc_id', 'safe']; $loc2_req = ['loc_id2', 'safe']; $time_req = ['time_req', 'safe']; $time_end_req = ['time_end_req', 'safe']; $consumer = ($service->consumer==1) ? ['consumer', 'required', 'message'=>Yii::t('app', 'Unesite broj odraslih koji će koristiti ovu uslugu.')] : ['consumer', 'safe']; $consumer_children = ($service->consumer!=0 && $service->consumer_children==1) ? ['consumer_children', 'required', 'message'=>Yii::t('app', 'Unesite broj dece koja će koristiti ovu uslugu.')] : ['consumer_children', 'safe']; if($service){ switch ($service->location) { case 1: $loc_req = ['loc_id', 'required']; $loc2_req = ['loc_id2', 'safe']; break; case 2: $loc_req = ['loc_id', 'required']; $loc2_req = ['loc_id2', 'required']; break; default: $loc_req = ['loc_id', 'safe']; $loc2_req = ['loc_id2', 'safe']; break; } $time_req = ($service->time==1 || $service->time==3) ? ['delivery_starts', 'required', 'message'=>Yii::t('app', 'Datum i vreme početka izvršenja usluge su obavezni.')] : ['delivery_starts', 'safe']; $time_end_req = ($service->time==3) ? ['delivery_ends', 'required', 'message'=>Yii::t('app', 'Datum i vreme završetka izvršenja usluge su obavezni.')] : ['delivery_ends', 'safe']; } return [ [['activity_id'], 'required'], [['activity_id', 'registered_to', 'process_id', 'loc_id', 'loc_id2', 'coverage', 'coverage_within', 'consumer', 'consumer_to', 'consumer_children', 'frequency', 'budget', 'currency_id', 'shipping', 'installation', 'support', 'turn_key', 'tools', 'phone_contact', 'success', 'hit_counter'], 'integer'], [['delivery_starts', 'delivery_ends', 'validity', 'success_time', 'update_time'], 'safe'], $loc_req, $loc2_req, $time_req, $time_end_req, $consumer, $consumer_children, ['consumer', 'integer', 'min'=>$service->consumer_range_min, 'max'=>$service->consumer_range_max], [['delivery_time_operator', 'consumer_operator', 'budget_operator'], 'default', 'value'=>'exact'], [['validity'], 'default', 'value' => function ($model, $attribute) { return date('Y-m-d H:i:s', strtotime('+7 days')); }], [['lang_code'], 'string', 'max' => 2], [['title'], 'string', 'max' => 100], [['delivery_time_operator', 'consumer_operator', 'frequency_unit', 'budget_operator', 'note', 'order_type', 'class'], 'string'], [['lang_code'], 'exist', 'skipOnError' => true, 'targetClass' => CsLanguages::className(), 'targetAttribute' => ['lang_code' => 'code']], [['process_id'], 'exist', 'skipOnError' => true, 'targetClass' => CsProcesses::className(), 'targetAttribute' => ['process_id' => 'id']], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => Yii::t('app', 'ID'), 'activity_id' => Yii::t('app', 'Activity ID'), 'loc_id' => Yii::t('app', 'Lokacija'), 'loc_id2' => Yii::t('app', 'Krajnja destinacija'), 'coverage' => Yii::t('app', 'Coverage'), 'coverage_within' => Yii::t('app', 'U radijusu lokacije'), 'delivery_starts' => Yii::t('app', 'Početak izvršenja usluge'), 'delivery_ends' => Yii::t('app', 'Završetak izvršenja usluge'), 'delivery_time_operator' => Yii::t('app', 'Delivery time operator'), 'consumer' => Yii::t('app', 'Consumer'), 'consumer_to' => Yii::t('app', 'Consumer To'), 'consumer_operator' => Yii::t('app', 'Consumer Operator'), 'consumer_children' => Yii::t('app', 'Consumer Children'), 'validity' => Yii::t('app', 'Rok za slanje ponuda'), 'frequency' => Yii::t('app', 'Učestalost'), 'frequency_unit' => Yii::t('app', 'Jedinica učestalosti'), 'budget' => Yii::t('app', 'Budget'), 'budget_operator' => Yii::t('app', 'Budget operator'), 'currency_id' => Yii::t('app', 'Valuta'), 'shipping' => Yii::t('app', 'Shipping'), 'installation' => Yii::t('app', 'Installation'), 'update_time' => Yii::t('app', 'Update Time'), 'lang_code' => Yii::t('app', 'Lang Code'), 'class' => Yii::t('app', 'Class'), 'registered_to' => Yii::t('app', 'Registered To'), 'phone_contact' => Yii::t('app', 'Kontakt telefon'), 'turn_key' => Yii::t('app', 'Ključ u ruke'), 'tools' => Yii::t('app', 'Alat i pribor'), 'support' => Yii::t('app', 'Podrška'), 'order_type' => Yii::t('app', 'Vrsta porudžbine'), 'process_id' => Yii::t('app', 'Process ID'), 'title' => Yii::t('app', 'Title'), 'note' => Yii::t('app', 'Note'), 'success' => Yii::t('app', 'Success'), 'success_time' => Yii::t('app', 'Success Time'), 'hit_counter' => Yii::t('app', 'Hit Counter'), ]; } /** * @return \yii\db\ActiveQuery */ public function getBids() { return $this->hasMany(Bids::className(), ['order_id' => 'id']); } /** * @return \yii\db\ActiveQuery */ public function getOrderIndustryProperties() { return $this->hasMany(OrderIndustryProperties::className(), ['order_id' => 'id']); } /** * @return \yii\db\ActiveQuery */ public function getOrderServices() { return $this->hasMany(OrderServices::className(), ['order_id' => 'id']); } public function getServices() { return $this->hasMany(CsServices::className(), ['id' => 'service_id']) ->viaTable('order_services', ['order_id' => 'id']); } /** * @return \yii\db\ActiveQuery */ public function getIndustry() { return $this->orderServices[0]->service->industry; } /** * @return \yii\db\ActiveQuery */ public function getLoc() { return $this->hasOne(Locations::className(), ['id' => 'loc_id']); } /** * @return \yii\db\ActiveQuery */ public function getLoc2() { return $this->hasOne(Locations::className(), ['id' => 'loc_id2']); } /** * @return \yii\db\ActiveQuery */ public function getLangCode() { return $this->hasOne(CsLanguages::className(), ['code' => 'lang_code']); } /** * @return \yii\db\ActiveQuery */ public function getProcess() { return $this->hasOne(CsProcesses::className(), ['id' => 'process_id']); } /** * @return \yii\db\ActiveQuery */ public function getRegisteredTo() { return $this->hasOne(Provider::className(), ['id' => 'registered_to']); } /** * @return \yii\db\ActiveQuery */ public function getCurrency() { return $this->hasOne(CsCurrencies::className(), ['id' => 'currency_id']); } /** * @return \yii\db\ActiveQuery */ public function getActivity() { return $this->hasOne(Activities::className(), ['id' => 'activity_id']); } /** * @return \yii\db\ActiveQuery */ public function getUser() { return $this->activity->user; } /** * @return \yii\db\ActiveQuery */ public function validityPercentage() { $start_f = new \DateTime($this->activity->time); $start = $start_f->format('U'); $validity_f = new \DateTime($this->validity); $validity = $validity_f->format('U'); $now_f = new \DateTime(); $now = $now_f->format('U'); return round(($now-$start)*100/($validity-$start)); } public function checkIfSkills() { return ($this->service->industry->skills) ? 0 : 1; } public function checkIfLocation() { return ($this->service->location!=0) ? 0 : 1; } public function checkIfTime() { return ($this->service->time!=0) ? 0 : 1; } public function checkIfFreq() { return ($this->service->frequency!=0) ? 0 : 1; } public function checkIfConsumer() { return ($this->service->consumer!=0) ? 0 : 1; } public function getNoLocation() { return 2-$this->checkIfSkills(); } public function getNoTime() { return 3-$this->checkIfSkills()-$this->checkIfLocation(); } public function getNoConsumer() { return 4-$this->checkIfSkills()-$this->checkIfLocation()-$this->checkIfTime(); } public function getNoFreq() { return 5-$this->checkIfSkills()-$this->checkIfLocation()-$this->checkIfTime()-$this->checkIfConsumer(); } public function getNoBudget() { return 6-$this->checkIfSkills()-$this->checkIfLocation()-$this->checkIfTime()-$this->checkIfConsumer()-$this->checkIfFreq(); } public function getNoVal() { return 7-$this->checkIfSkills()-$this->checkIfLocation()-$this->checkIfTime()-$this->checkIfConsumer()-$this->checkIfFreq(); } public function getNoOther() { return 8-$this->checkIfSkills()-$this->checkIfLocation()-$this->checkIfTime()-$this->checkIfConsumer()-$this->checkIfFreq(); } public function getNoUac() { return 9-$this->checkIfSkills()-$this->checkIfLocation()-$this->checkIfTime()-$this->checkIfConsumer()-$this->checkIfFreq(); } public function afterSave($insert, $changedAttributes) { // user log $userLog = new \common\models\UserLog(); $userLog->user_id = Yii::$app->user->id; $userLog->action = $insert ? 'order_created' : 'order_updated'; $userLog->alias = $this->id; $userLog->time = date('Y-m-d H:i:s'); $userLog->save(); parent::afterSave($insert, $changedAttributes); } }
{ "content_hash": "0f4c0f1eafa25fe2e6d18bb3c33d43a7", "timestamp": "", "source": "github", "line_count": 360, "max_line_length": 313, "avg_line_length": 33.37777777777778, "alnum_prop": 0.5440246338215713, "repo_name": "bokko79/servicemapp", "id": "e5ac8dd832b9de4b5458942f54749f60ccef21cb", "size": "12031", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "common/models/Orders.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "809" }, { "name": "Batchfile", "bytes": "1541" }, { "name": "CSS", "bytes": "645101" }, { "name": "JavaScript", "bytes": "710080" }, { "name": "PHP", "bytes": "2687214" } ], "symlink_target": "" }
'use strict'; // You should actually bother to unit test your command // because that's what responsible developers do. //this is a dummy spec describe('hello_spec', function () { it('should add 1+1 correctly', function (done) { var onePlusOne = 1 + 2; onePlusOne.should.equal(3); // must call done() so that mocha know that we are... done. // Useful for async tests. done(); }); });
{ "content_hash": "75b9ebfdadd7b5d37ff9c6cf76aa41eb", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 62, "avg_line_length": 26.866666666666667, "alnum_prop": 0.6625310173697271, "repo_name": "Sophrinix/ti-sdk-build-hook", "id": "3fc13a66d5772c5d8ea45cecca11af7be5db7d2b", "size": "403", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/run_command_spec.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "10935" } ], "symlink_target": "" }
package org.apache.geode.cache.lucene.internal; import static org.apache.geode.cache.lucene.test.LuceneTestUtilities.DEFAULT_FIELD; import static org.junit.Assert.*; import static org.mockito.Mockito.*; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.ExpectedException; import org.mockito.Mockito; import org.apache.geode.cache.Cache; import org.apache.geode.cache.Region; import org.apache.geode.cache.lucene.LuceneQuery; import org.apache.geode.test.junit.categories.UnitTest; @Category(UnitTest.class) public class LuceneQueryFactoryImplJUnitTest { @Rule public ExpectedException thrown = ExpectedException.none(); @Test public void shouldCreateQueryWithCorrectAttributes() { Cache cache = mock(Cache.class); Region region = mock(Region.class); when(cache.getRegion(any())).thenReturn(region); LuceneQueryFactoryImpl f = new LuceneQueryFactoryImpl(cache); f.setPageSize(5); f.setLimit(25); LuceneQuery<Object, Object> query = f.create("index", "region", new StringQueryProvider("test", DEFAULT_FIELD)); assertEquals(25, query.getLimit()); assertEquals(5, query.getPageSize()); Mockito.verify(cache).getRegion(Mockito.eq("region")); } @Test public void shouldThrowIllegalArgumentWhenRegionIsMissing() { Cache cache = mock(Cache.class); LuceneQueryFactoryImpl f = new LuceneQueryFactoryImpl(cache); thrown.expect(IllegalArgumentException.class); LuceneQuery<Object, Object> query = f.create("index", "region", new StringQueryProvider("test", DEFAULT_FIELD)); } }
{ "content_hash": "5ea61d7dd95dfec1741a45d79a3bb5e2", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 84, "avg_line_length": 32.68, "alnum_prop": 0.7545899632802937, "repo_name": "smanvi-pivotal/geode", "id": "ae69ae9e0b71b1fd4317c16d64d6e30bb90aa9d3", "size": "2423", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "106707" }, { "name": "Groovy", "bytes": "2928" }, { "name": "HTML", "bytes": "3998074" }, { "name": "Java", "bytes": "26700079" }, { "name": "JavaScript", "bytes": "1781013" }, { "name": "Ruby", "bytes": "6751" }, { "name": "Shell", "bytes": "21891" } ], "symlink_target": "" }
package it.polimi.ingsw.game.card.object; import it.polimi.ingsw.game.GameState; import it.polimi.ingsw.game.card.Card; import it.polimi.ingsw.game.player.GamePlayer; import it.polimi.ingsw.game.state.PlayerState; /** Abstract class for a generic Object Card. * Always drawn by a human after using some sorts of Dangerous Cards. * * @author Alain Carlucci (alain.carlucci@mail.polimi.it) * @author Michele Albanese (michele.albanese@mail.polimi.it) * @since 23 May 2015 */ public abstract class ObjectCard implements Card { /** Game State */ protected GameState mGameState; /** Game Player */ protected GamePlayer mGamePlayer; /** Name */ protected final String mName; /** Id */ protected final int mId; /** Constructor * * @param state Game State * @param name Name */ protected ObjectCard(GameState state, int id, String name) { mGameState = state; mGamePlayer = state.getCurrentPlayer(); mName = name; mId = id; } /** Resolve the effect of the card. * * @return Next state for the invoker */ @Override public abstract PlayerState doAction(); /** Get the card name * * @return The card name */ public String getName() { return mName; } /** Get the card id * * @return The card id */ public int getId() { return mId; } /** Is the card usable? * * @return True if the card is usable */ public abstract boolean isUsable(); }
{ "content_hash": "688229892b52204663e15677755e522d", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 69, "avg_line_length": 23.594202898550726, "alnum_prop": 0.5945945945945946, "repo_name": "carpikes/ingsw1-eftaios", "id": "86fd8313a19d54ed63e7d6c3d6ec494810445502", "size": "1628", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ingsw/src/main/java/it/polimi/ingsw/game/card/object/ObjectCard.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "375812" }, { "name": "Shell", "bytes": "167" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/><!-- using block title in layout.dt--><!-- using block ddox.defs in ddox.layout.dt--><!-- using block ddox.title in ddox.layout.dt--> <title>Function awe_webview_load_html</title> <link rel="stylesheet" type="text/css" href="../../styles/ddox.css"/> <link rel="stylesheet" href="../../prettify/prettify.css" type="text/css"/> <script type="text/javascript" src="../../scripts/jquery.js">/**/</script> <script type="text/javascript" src="../../prettify/prettify.js">/**/</script> <script type="text/javascript" src="../../scripts/ddox.js">/**/</script> </head> <body onload="prettyPrint(); setupDdox();"> <nav id="main-nav"><!-- using block navigation in layout.dt--> <ul class="tree-view"> <li class="collapsed tree-view"> <a href="#" class="package">components</a> <ul class="tree-view"> <li> <a href="../../components/animation.html" class=" module">animation</a> </li> <li> <a href="../../components/assetanimation.html" class=" module">assetanimation</a> </li> <li> <a href="../../components/assets.html" class=" module">assets</a> </li> <li> <a href="../../components/camera.html" class=" module">camera</a> </li> <li> <a href="../../components/icomponent.html" class=" module">icomponent</a> </li> <li> <a href="../../components/lights.html" class=" module">lights</a> </li> <li> <a href="../../components/material.html" class=" module">material</a> </li> <li> <a href="../../components/mesh.html" class=" module">mesh</a> </li> <li> <a href="../../components/userinterface.html" class=" module">userinterface</a> </li> </ul> </li> <li class="collapsed tree-view"> <a href="#" class="package">core</a> <ul class="tree-view"> <li> <a href="../../core/dgame.html" class=" module">dgame</a> </li> <li> <a href="../../core/gameobject.html" class=" module">gameobject</a> </li> <li> <a href="../../core/gameobjectcollection.html" class=" module">gameobjectcollection</a> </li> <li> <a href="../../core/prefabs.html" class=" module">prefabs</a> </li> <li> <a href="../../core/properties.html" class=" module">properties</a> </li> <li> <a href="../../core/reflection.html" class=" module">reflection</a> </li> <li> <a href="../../core/scene.html" class=" module">scene</a> </li> </ul> </li> <li class="collapsed tree-view"> <a href="#" class="package">graphics</a> <ul class="tree-view"> <li class="collapsed tree-view"> <a href="#" class="package">adapters</a> <ul class="tree-view"> <li> <a href="../../graphics/adapters/adapter.html" class=" module">adapter</a> </li> <li> <a href="../../graphics/adapters/linux.html" class=" module">linux</a> </li> <li> <a href="../../graphics/adapters/mac.html" class=" module">mac</a> </li> <li> <a href="../../graphics/adapters/win32.html" class=" module">win32</a> </li> </ul> </li> <li class="collapsed tree-view"> <a href="#" class="package">shaders</a> <ul class="tree-view"> <li class="collapsed tree-view"> <a href="#" class="package">glsl</a> <ul class="tree-view"> <li> <a href="../../graphics/shaders/glsl/ambientlight.html" class=" module">ambientlight</a> </li> <li> <a href="../../graphics/shaders/glsl/animatedgeometry.html" class=" module">animatedgeometry</a> </li> <li> <a href="../../graphics/shaders/glsl/directionallight.html" class=" module">directionallight</a> </li> <li> <a href="../../graphics/shaders/glsl/geometry.html" class=" module">geometry</a> </li> <li> <a href="../../graphics/shaders/glsl/pointlight.html" class=" module">pointlight</a> </li> <li> <a href="../../graphics/shaders/glsl/userinterface.html" class=" module">userinterface</a> </li> </ul> </li> <li> <a href="../../graphics/shaders/glsl.html" class=" module">glsl</a> </li> <li> <a href="../../graphics/shaders/shaders.html" class=" module">shaders</a> </li> </ul> </li> <li> <a href="../../graphics/adapters.html" class=" module">adapters</a> </li> <li> <a href="../../graphics/graphics.html" class=" module">graphics</a> </li> <li> <a href="../../graphics/shaders.html" class=" module">shaders</a> </li> </ul> </li> <li class=" tree-view"> <a href="#" class="package">utility</a> <ul class="tree-view"> <li> <a href="../../utility/awesomium.html" class="selected module">awesomium</a> </li> <li> <a href="../../utility/concurrency.html" class=" module">concurrency</a> </li> <li> <a href="../../utility/config.html" class=" module">config</a> </li> <li> <a href="../../utility/filepath.html" class=" module">filepath</a> </li> <li> <a href="../../utility/input.html" class=" module">input</a> </li> <li> <a href="../../utility/output.html" class=" module">output</a> </li> <li> <a href="../../utility/string.html" class=" module">string</a> </li> <li> <a href="../../utility/time.html" class=" module">time</a> </li> </ul> </li> <li> <a href="../../components.html" class=" module">components</a> </li> <li> <a href="../../core.html" class=" module">core</a> </li> <li> <a href="../../graphics.html" class=" module">graphics</a> </li> <li> <a href="../../utility.html" class=" module">utility</a> </li> </ul> <noscript> <p style="color: red">The search functionality needs JavaScript enabled</p> </noscript> <div id="symbolSearchPane" style="display: none"> <p> <input id="symbolSearch" type="text" placeholder="Search for symbols" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/> </p> <ul id="symbolSearchResults" style="display: none"></ul> <script type="application/javascript" src="../../symbols.js"></script> <script type="application/javascript"> //<![CDATA[ var symbolSearchRootDir = "../../"; $('#symbolSearchPane').show(); //]]> </script> </div> </nav> <div id="main-contents"> <h1>Function awe_webview_load_html</h1><!-- using block body in layout.dt--><!-- Default block ddox.description in ddox.layout.dt--><!-- Default block ddox.sections in ddox.layout.dt--><!-- using block ddox.members in ddox.layout.dt--> <p> Loads a string of HTML into the WebView asynchronously. </p> <section> <p> @param <a href="../../utility/awesomium/awe_webview_load_html.html#webview"><code class="prettyprint lang-d">webview</code></a> The WebView instance. </p> <p> @param <a href="../../utility/awesomium/awe_webview_load_html.html#html"><code class="prettyprint lang-d">html</code></a> The HTML string (ASCII) to load. </p> <p> @param <a href="../../utility/awesomium/awe_webview_load_html.html#frame_name"><code class="prettyprint lang-d">frame_name</code></a> The name of the frame to load the HTML in; leave this blank to load in the main frame. </p> </section> <section> <h2>Prototype</h2> <pre class="code prettyprint lang-d prototype"> void awe_webview_load_html( &nbsp;&nbsp;<a href="../../utility/awesomium/awe_webview.html">awe_webview</a>* webview, &nbsp;&nbsp;const(<a href="../../utility/awesomium/awe_string.html">awe_string</a>)* html, &nbsp;&nbsp;const(<a href="../../utility/awesomium/awe_string.html">awe_string</a>)* frame_name ) extern(C);</pre> </section> <section> <h2>Authors</h2><!-- using block ddox.authors in ddox.layout.dt--> </section> <section> <h2>Copyright</h2><!-- using block ddox.copyright in ddox.layout.dt--> </section> <section> <h2>License</h2><!-- using block ddox.license in ddox.layout.dt--> </section> </div> </body> </html>
{ "content_hash": "5d936c420772a19141cdf5eb30e71689", "timestamp": "", "source": "github", "line_count": 238, "max_line_length": 238, "avg_line_length": 36.10084033613445, "alnum_prop": 0.5484171322160148, "repo_name": "Circular-Studios/Dash-Docs", "id": "61629614a8e00c4d3f0f752329db59cd16ef7c6d", "size": "8592", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "api/v0.6.0/utility/awesomium/awe_webview_load_html.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "146638" }, { "name": "HTML", "bytes": "212463985" }, { "name": "JavaScript", "bytes": "72098" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using CoreAnimation; using Foundation; using UIKit; using SettingsStudio; using XWeather.Clients; using XWeather.Unified; namespace XWeather.iOS { public partial class WeatherPvc : UIPageViewController { List<UITableViewController> Controllers = new List<UITableViewController> (3); public WeatherPvc (IntPtr handle) : base (handle) { } public override void ViewDidLoad () { WuClient.Shared.UpdatedSelected += handleFirstUpdatedSelected; base.ViewDidLoad (); initToolbar (); initControllers (); } public override void ViewWillAppear (bool animated) { base.ViewWillAppear (animated); updateToolbarButtons (true); } public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender) { updateToolbarButtons (false); if (segue.Identifier.Equals ("locationsSegue", StringComparison.OrdinalIgnoreCase)) { var current = ViewControllers.FirstOrDefault (); if (current != null) Analytics.TrackPageViewEnd (ViewControllers.FirstOrDefault (), WuClient.Shared.Selected); } } public override UIStatusBarStyle PreferredStatusBarStyle () => UIStatusBarStyle.LightContent; partial void closeClicked (NSObject sender) { updateToolbarButtons (true); DismissViewController(true, () => { var current = ViewControllers.FirstOrDefault(); if (current != null) Analytics.TrackPageViewStart(current, childPageName(current), WuClient.Shared.Selected); }); } partial void settingsClicked (NSObject sender) { var settingsString = UIApplication.OpenSettingsUrlString?.ToString (); if (!string.IsNullOrEmpty (settingsString)) { var settingsUrl = NSUrl.FromString (settingsString); if (UIApplication.SharedApplication.OpenUrl (settingsUrl)) { Analytics.TrackPageView (Pages.Settings.Name ()); } } } void updateToolbarButtons (bool dismissing) { foreach (var button in toolbarButtons) { button.Hidden = dismissing ? button.Tag > 1 : button.Tag < 2; } pageIndicator.Hidden = !dismissing; } void handleFirstUpdatedSelected (object sender, EventArgs e) { WuClient.Shared.UpdatedSelected -= handleFirstUpdatedSelected; WuClient.Shared.UpdatedSelected += handleUpdatedSelected; refreshForUpdatedSelected (); } void handleUpdatedSelected (object sender, EventArgs e) { refreshForUpdatedSelected (); var current = ViewControllers.FirstOrDefault (); if (current != null) Analytics.TrackPageViewStart (current, childPageName (current), WuClient.Shared.Selected); } void refreshForUpdatedSelected () { BeginInvokeOnMainThread (() => { updateToolbarButtons (true); reloadData (); }); } void reloadData () { updateBackground (); foreach (var controller in Controllers) controller?.TableView?.ReloadData (); } void updateBackground () { var location = WuClient.Shared.Selected; var random = location == null || Settings.RandomBackgrounds; var layer = View.Layer.Sublayers [0] as CAGradientLayer; if (layer == null) { layer = new CAGradientLayer (); layer.Frame = View.Bounds; View.Layer.InsertSublayer (layer, 0); } var gradients = location.GetTimeOfDayGradient (random); if (layer?.Colors?.Length > 0 && layer.Colors [0] == gradients.Item1 [0] && layer.Colors [1] == gradients.Item1 [1]) return; CATransaction.Begin (); CATransaction.AnimationDuration = 1.5; layer.Colors = gradients.Item1; CATransaction.Commit (); } void initControllers () { Controllers = new List<UITableViewController> { Storyboard.Instantiate<DailyTvc> (), Storyboard.Instantiate<HourlyTvc> (), Storyboard.Instantiate<DetailsTvc> () }; GetNextViewController += (pvc, rvc) => rvc.Equals (Controllers [0]) ? Controllers [1] : rvc.Equals (Controllers [1]) ? Controllers [2] : null; GetPreviousViewController += (pvc, rvc) => rvc.Equals (Controllers [2]) ? Controllers [1] : rvc.Equals (Controllers [1]) ? Controllers [0] : null; WillTransition += (s, e) => { updateBackground (); }; DidFinishAnimating += (s, e) => { var index = Controllers.IndexOf ((UITableViewController)ViewControllers [0]); pageIndicator.CurrentPage = index; Settings.WeatherPage = index; }; SetViewControllers (new [] { Controllers [Settings.WeatherPage] }, UIPageViewControllerNavigationDirection.Forward, false, (finished) => { getData (); }); pageIndicator.CurrentPage = Settings.WeatherPage; updateBackground (); } void initToolbar () { toolbarView.TranslatesAutoresizingMaskIntoConstraints = false; NavigationController.View.AddSubview (toolbarView); NavigationController.View.AddConstraints (NSLayoutConstraint.FromVisualFormat (@"H:|[toolbarView]|", 0, "toolbarView", toolbarView)); NavigationController.View.AddConstraints (NSLayoutConstraint.FromVisualFormat (@"V:[toolbarView(44.0)]|", 0, "toolbarView", toolbarView)); } Pages childPageName (UIViewController page) { if (page != null) { if (page.Equals (Controllers [0])) return Pages.WeatherDaily; if (page.Equals (Controllers [1])) return Pages.WeatherHourly; if (page.Equals (Controllers [2])) return Pages.WeatherDetails; } return Pages.Unknown; } #if DEBUG void getData () => TestDataProvider.InitTestDataAsync (); #else LocationProvider LocationProvider; void getData () { if (LocationProvider == null) LocationProvider = new LocationProvider (); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; System.Threading.Tasks.Task.Run (async () => { var location = await LocationProvider.GetCurrentLocationCoordnatesAsync (); await WuClient.Shared.GetLocations (location); BeginInvokeOnMainThread (() => { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }); }); } #endif } }
{ "content_hash": "89858578a781369c6d5bfde1f320bea9", "timestamp": "", "source": "github", "line_count": 241, "max_line_length": 166, "avg_line_length": 25.04149377593361, "alnum_prop": 0.7010770505385253, "repo_name": "colbylwilliams/XWeather", "id": "31ad9d61e5fb01d169d19cc0704db598a6a2b4b8", "size": "6039", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "XWeather/iOS/ViewControllers/WeatherPvc.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "236131" }, { "name": "Shell", "bytes": "11401" }, { "name": "Smalltalk", "bytes": "426" } ], "symlink_target": "" }
var playState = { create: function(){ var background = game.add.sprite(0, 0, 'cidade'); background.width = 1300; background.height = 650; graphics = game.add.graphics(0, 0); groupCidade = game.add.group(); groupCidade.inputEnableChildren = true; var x = 100; for (var i = 0; i < 3; i++){ // Gera os retangulos que ficarão atras das imagens graphics.beginFill(0xff7b00); graphics.lineStyle(3, 0x05005e, 1); graphics.drawRoundedRect(x, 200, 315, 190, 10); graphics.endFill(); var button = groupCidade.create(x, 200, graphics.generateTexture()); button.name = 'groupCidade-child-' + i; x = x + 400; } graphics.destroy(); var cachorro = game.add.sprite(110, 210, 'cachorro'); cachorro.width = 300; cachorro.height = 170; // Desenha o gato e a borda da box var gato = game.add.sprite(510, 210, 'gato'); gato.width = 300; gato.height = 170; // Desenha o passaro e a borda da box var passaro = game.add.sprite(910, 210, 'passaro'); passaro.width = 300; passaro.height = 170; groupCidade.onChildInputDown.add(onDown, this); groupCidade.onChildInputOver.add(onOver, this); groupCidade.onChildInputOut.add(onOut, this); function onDown (sprite) { sprite.tint = '#f2ff00'; } function onOver (sprite) { sprite.tint = '#f2ff00'; sprite.tint = '#30bf20'; } function onOut (sprite) { sprite.tint = 0xffffff; } }, update: function(){ }, Win: function(){ game.state.start('win'); } };
{ "content_hash": "520483ed79352840759b0bd43a7903e4", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 80, "avg_line_length": 24.25, "alnum_prop": 0.5263157894736842, "repo_name": "RenatoMAlves/AnimaSom-Game", "id": "06a713b02c60e5ceacf0cb7904957e7388eb5a4e", "size": "1844", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".history/animaSom/js/play_20170531212513.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "675" }, { "name": "JavaScript", "bytes": "1183297" } ], "symlink_target": "" }
package consulo.lombok.processors.impl; import java.util.List; import javax.annotation.Nonnull; import com.intellij.openapi.util.Condition; import com.intellij.psi.*; import com.intellij.psi.impl.light.LightMethod; import com.intellij.psi.impl.light.LightMethodBuilder; import com.intellij.psi.impl.light.LightTypeParameter; import com.intellij.util.containers.ContainerUtil; import consulo.lombok.module.extension.LombokModuleExtension; import consulo.lombok.processors.LombokSelfClassProcessor; import consulo.lombok.processors.util.LombokClassUtil; import consulo.lombok.processors.util.LombokUtil; import consulo.module.extension.ModuleExtension; /** * @author VISTALL * @since 18:25/31.03.13 */ public abstract class NArgsConstructorAnnotationProcessor extends LombokSelfClassProcessor { public NArgsConstructorAnnotationProcessor(String annotationClass) { super(annotationClass); } @Override public Class<? extends ModuleExtension> getModuleExtensionClass() { return LombokModuleExtension.class; } @Override public void processElement(@Nonnull PsiClass parent, @Nonnull PsiClass psiClass, @Nonnull List<PsiElement> result) { final PsiAnnotation affectedAnnotation = getAffectedAnnotation(psiClass); StringBuilder builder = new StringBuilder(); String modifier = LombokUtil.getModifierFromAnnotation(affectedAnnotation, "access"); if(modifier == null) { modifier = PsiModifier.PUBLIC; } builder.append(modifier).append(" ").append(psiClass.getName()).append("("); List<PsiField> applicableFields = LombokClassUtil.getOwnFields(psiClass); applicableFields = ContainerUtil.filter(applicableFields, new Condition<PsiField>() { @Override public boolean value(PsiField psiField) { return isFieldIsApplicable(psiField); } }); for(int i = 0; i < applicableFields.size(); i++) { if(i != 0) { builder.append(", "); } PsiField field = applicableFields.get(i); builder.append(field.getType().getCanonicalText()).append(" ").append(field.getName()); } builder.append(") {\n"); for(PsiField psiField : applicableFields) { builder.append("this.").append(psiField.getName()).append(" = ").append(psiField.getName()).append(";\n"); } builder.append("}"); PsiMethod methodFromText = JavaPsiFacade.getElementFactory(psiClass.getProject()).createMethodFromText(builder.toString(), psiClass); LightMethod constructor = new LightMethod(psiClass.getManager(), methodFromText, psiClass); constructor.setNavigationElement(affectedAnnotation); result.add(constructor); createStaticConstructor(parent, psiClass, result, affectedAnnotation, applicableFields); } private void createStaticConstructor(PsiClass parent, PsiClass psiClass, List<PsiElement> result, PsiAnnotation affectedAnnotation, List<PsiField> applicableFields) { final PsiAnnotationMemberValue staticName = affectedAnnotation.findAttributeValue(getStaticConstructorAttributeName()); if(staticName instanceof PsiLiteralExpression) { final Object value = ((PsiLiteralExpression) staticName).getValue(); if(value instanceof String) { LightMethodBuilder methodBuilder = new LightMethodBuilder(psiClass.getManager(), parent.getLanguage(), (String) value); methodBuilder.setContainingClass(psiClass); methodBuilder.setNavigationElement(affectedAnnotation); methodBuilder.addModifiers(PsiModifier.STATIC, PsiModifier.PUBLIC); methodBuilder.setMethodReturnType(JavaPsiFacade.getElementFactory(psiClass.getProject()).createType(psiClass)); for(PsiTypeParameter typeParameter : psiClass.getTypeParameters()) { methodBuilder.addTypeParameter(new LightTypeParameter(typeParameter)); } for(PsiField field : applicableFields) { methodBuilder.addParameter(field.getName(), field.getType()); } result.add(methodBuilder); } } } protected boolean isFieldIsApplicable(@Nonnull PsiField psiField) { return !psiField.hasModifierProperty(PsiModifier.STATIC); } @Nonnull protected String getStaticConstructorAttributeName() { return "staticName"; } @Nonnull @Override public Class<? extends PsiElement> getCollectorPsiElementClass() { return PsiMethod.class; } }
{ "content_hash": "562105f042404334aa937fab09fb64c8", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 165, "avg_line_length": 31.901515151515152, "alnum_prop": 0.7715507005461886, "repo_name": "consulo/consulo-lombok", "id": "6e485a50c191ad23f724a146bd7219d8eff6fd19", "size": "4801", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lombok-base/src/main/java/consulo/lombok/processors/impl/NArgsConstructorAnnotationProcessor.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "714" }, { "name": "Java", "bytes": "102855" } ], "symlink_target": "" }
import todos, { TodosState } from './todos' import visibilityFilter, { VisibilityFilterState } from './visibilityFilter' import { combineReducers, Reducer } from 'redux' import { Action } from '../actions' export interface State { todos: TodosState visibilityFilter: VisibilityFilterState } const reducer: Reducer<State, Action> = combineReducers({ todos, visibilityFilter }) export default reducer
{ "content_hash": "87fe3e2f5a9730e52b24ff4da607af58", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 76, "avg_line_length": 25.625, "alnum_prop": 0.7585365853658537, "repo_name": "rpowelll/react-todo", "id": "878f5aa3469dfed701ea6ae0a930bc0ad766e2ce", "size": "410", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/reducers/todoApp.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2205" }, { "name": "HTML", "bytes": "1144" }, { "name": "JavaScript", "bytes": "17314" } ], "symlink_target": "" }