I was in Centralia, IL all day today (5/22), which is about 5 hours from where I live. Somewhere in between hour 1 and boredtodeathville, I was trying to think up something I could do for ds106 while I was driving. My mind flashed back to an assignment in which you take a photo every step for 10 steps, and then create a collage.
I’ve wanted to do that one following those rules in my back yard, but it seemed like a good place to start. So, I decided to take a photo every mile for 20 miles. What I got is shown below (click the thumbnail for the full-size image to see details, all 4000px worth).
The hardest part for me was convincing myself to only take one picture. I wanted to maintain the heart of grabbing a raw image and then sharing the flow of time, space, and imagery. And that included the blurry photo. I had to almost tell myself out loud not to take a “better” picture.
I have another plan for this image series, but that will have to come another time.
As always, the GIMP .xcf file is available for remixes.
Written on May 22nd , 2013 by Brian Bennett Categorized in: ds106
Leave a comment


Guys, can you help me out with a nice pally/fighter, wm, dd?
Maybe something like this: 13 pally / fighter 7 wm more wm? more fighter? more wm? 5 dd, so I wont get flanked/sneaked (or is that 6?)
Please make it dex based with rapier. Or maybe kama's?
I'd also like to know final ab and ac + hp.
Thanks a million!
Ok forgot something: it needs to have 22 lvls of wm. So maybe 22 wm, 13 fighter/pally and 5 dd? 5 dd is enough to not get flanked/sneaked?
Huh? I would never build a dex fighter without a few core feats.
Now your class selection can't get any of those, so I'd suggest you either replace DD with rogue or SD, or you build a strength fighter, which would be more appropriate for the chosen class combo.
Oh, and only monks use kamas. No reason why anyone else would use them.
Personally I don't do dwarves, so I won't proffer an actual build. Have you tried searching through the hundreds of builds already posted here?
Thanks for your reply.
I can get improved evasion from items. Also I can get higher saves from items.
If you take 6 levels of dd, you wont be flat footed (same as uncanny dodge) anymore, and you will be able to get sneaked. So going the dex-wm route will give you 5 attacks and high ac.


Update your browser to view this website correctly. Update my browser now
It’s been a while since our last update, quite a while we might add. Late 2014 we recorded an album we were very excited about, but then disaster struck. Early 2015 our practice space burnt down and basically all of our equipment was lost. What we also lost was momentum. It took a lot of time to reinvigorate the band. The past is the past, fast forward to now. We’re excited to announce that the album will finally see the light of day somewhere in the coming months.
On a sad note, earlier this year Geert decided to leave the band. His decision was entirely personal. He was a founding member and his tour-of-bass-duty lasted a decade, but time and things change. We want to thank him for his friendship and dedication. Good luck with future endeavours!
We’re not without a bass player however, since Ronald van Wonderen and his 5-string recently joined us. Welcome, Ronald! We’re busy rehearsing all our material, including an album’s worth of new material we want to record as soon as possible. Check out our new website and stay tuned for more updates!
- No upcoming shows
Herman Wilken - guitar
Nico Nijland - guitar
Ronald van Wonderen - bass
Ralph van Reijendam - drums


Contributors Around the World
Sample Repository Group One
Sample Repository Group Two
Loading Table...
Sample Repository Group One
GitHub Username
GitHub URL
When Created
Company
Location
Sample Repository Group Two
GitHub Username
GitHub URL
When Created
Company
Location


Fliperoo
To change the image, go to the Developer Tools (CTRL+SHIFT+I on Chrome), find where it says img src, and change the link in the quotation marks to the link of the new image


EDUCATION
University of Port Harcourt, Bachelor of Science in Computer
Science, October 2016 ,
Second Class Upper
SKILLS
Languages: JavaScript(proficient), php(familiar), HTML,
CSS
Frameworks: Node.Js, expressJs
EXPERIENCE
BitHub Choba, Port Harcourt, Industrial Training(August 2015)
-
Created new functionality for a private pharmacy's prescription
drug information system
-
Worked with end -users to determine and gather their information
and needs
University of Port Harcourt, Computing Science Labs 1 and 2
Abuja
Campus, Lab Assistant (September 2013 – October 2016)
-
Resolved issues regarding networking (wired, wireless, and
dialup),
and email problems for the lab users
- Assisted students with programming and software questions
-
Communicated with faculty and department members through
email,
telephone, and face to face
BitHub Choba, Port Harcourt (February - October 2017)
- Helped in onboarding new students to the IT facility
-
Trained students on the basics of JavaScript, DOM manipulation,
JavaScript object model
Local Government Secretariat, Shendam Plateau (December 2017 –
October 2018)
-
Manage service desk and log issues using the trouble ticket
system
PROJECTS
Created a student result and transcript management system
-
An online transcript generation system running on Apache Tomcat
-
Implemented the system using PHP and MysQl, delivering a
friendly
user interface together with a relational database
-
Extracted student information from the old excel spreadsheet
.xls storage formats to an SQl driven relational database
Created a bank application
-
A light-weight core banking application that powers banking
operations
like account creation, customer deposit and withdrawals
-
Utilized HTML, CSS, JavaScript, Node.js, and Git in the
implementation.
-
Created RESTFul APIS, utilizing modern JWT authorization
mechanism
TRAINING PROGRAMS
Node.JS: The Complete Node.JS Developer Course – Udemy
OOP: Foundations of Programming Object-Oriented Design –
Lynda.com
ReactJS: The Complete Node.JS Developer Course – Udemy
Andela Bootcamp Cycle 44


tcl_call/3
tcl_call/3 | - execute Tcl script
tcl_eval/3 | - evaluate Tcl script
FORMS
tcl_call(+Interpreter, +Script, ?Result) tcl_eval(+Interpreter, +ArgList,
?Result)
DESCRIPTION
tcl_call/3 and tcl_evla/3 both execute a script using the Tcl interpreter and return the Tcl result in Result.
Tcl_call passes the Script argument as a single argument toTcl’s eval command.
Tcl_eval passes the elements of ArgList as arguments to Tcl’s eval command, which
concatenates the arguments before evalating them.
Tcl_call’s script can take the following forms:
List The list is converted to a Tcl list and evaluated by the Tcl interpreter. The
list may contain, atoms, numbers and lists.
Atom The atom is converted to a string and evaluated by the Tcl interpreter.
Tcl_eval’s ArgList may contain atoms, numbers or lists.
EXAMPLES
?- tcl_call(i, [puts, abc], R).
R =
Prints ‘abc’ to standard output, and binds R to ‘’.
?- tcl_call(i, [set, x, 3.4], R).
R = 3.4
Sets the Tcl variable x to 3.4 and binds R to 3.4.
?- tcl_call(i, ‘set x’, R).
R = 3.4
Binds R to 3.4.
?- tcl_eval(i,
[‘if [file exists ‘, Name, ‘] puts file-found’],
R).
ERRORS
Interpreter is not an atom.
Script is not an atom or list.
Script generates a Tcl error.


GPS 1.2
Michael Chang & Ali Esmaili
What is pair programming?
Technique where one individual (driver) writes the code and the other (navigator) directs and reviews the code.
Why is pair programming important?
- To learn from each other
- To have two sets of eyes while writing code
- Driver can focus on completing current task and navigator can focus on being strategic
- Each can act as an inspirational springboard for the other - reviewing code, helping to clarify concepts, etc.
- To learn to how to work/cooperate well with others
Driver vs. Navigator?
Driver
- Actually implements
- Focuses on the syntax
- Complete current task
Nagivator
- How to implement
- Focuses on the line that is being written
- Be strategic


This function creates a harmonized BMI variable. The BMI variable provided by the CCHS calculates BMI using methods that vary across cycles, leading to measurement error when using multiple CCHS cycles. In certain CCHS cycles (2001-2003, 2007+), there are age restrictions in which respondents under the age of 20 and over the age of 64 were not included. Across all CCHS cycles, female respondents who identified as being pregnant were excluded; and in certain CCHS cycles (2003-2007, 2013-2014), females who did not answer the pregnancy question were coded as NS (not stated) for HWTGBMI. As well, in certain CCHS cycles (2001-2003, 2009-2014), respondents outside certain height and weight ranges (0.914-2.108m for height, 0-260kg for weight) were excluded from HWTGBMI.
bmi_fun() creates a derived variable (HWTGBMI_der) that is harmonized across all CCHS cycles. This function divides weight by the square of height.
bmi_fun(HWTGHTM, HWTGWTK)
| HWTGHTM | CCHS variable for height (in meters) |
|---|---|
| HWTGWTK | CCHS variable for weight (in kilograms) |
numeric value for BMI in the HWTGBMI_der variable
For HWTGBMI_der, there are no restrictions to age, height, weight, or pregnancy status. While pregnancy was consistent across all CCHS cycles, its variable (MAM_037) was not available in the PUMF CCHS datasets so it could not be harmonized and included into the function.
For any single CCHS survey year, it is appropriate to use the CCHS BMI variable (HWTGBMI) that is also available on cchsflow. HWTGBMI_der is recommended when using multiple survey cycles.
HWTGBMI_der uses the CCHS variables for height and weight that have been transformed by cchsflow. In order to generate a value for BMI across CCHS cycles, height and weight must be transformed and harmonized.
In earlier CCHS cycles (2001 and 2003), height was collected in inches; while in later CCHS cycles (2005+) it was collected in meters. To harmonize values across cycles, height was converted to meters (to 3 decimal points). Weight was collected in kilograms across all CCHS cycles, so no transformations were required in the harmonization process.
# Using bmi_fun() to create BMI values between cycles # bmi_fun() is specified in variable_details.csv along with the # CCHS variables and cycles included. # To transform the derived BMI variable, use rec_with_table() for each cycle # and specify HWTGBMI_der, along with height (HWTGHTM) and weight (HWTGWTK). # Then by using merge_rec_data(), you can combined HWTGBMI_der across # cycles. library(cchsflow) bmi2001 <- rec_with_table( cchs2001_p, c( "HWTGHTM", "HWTGWTK", "HWTGBMI_der" ) )#>#>#>#>#>#> HWTGHTM HWTGWTK HWTGBMI_der #> 1 1.422 56.25 27.81784 #> 2 1.549 51.75 21.56788 #> 3 1.803 78.75 24.22474 #> 4 1.575 60.75 24.48980 #> 5 1.727 63.00 21.12301 #> 6 1.829 91.80 27.44197#>#>#>#>#> HWTGHTM HWTGWTK HWTGBMI_der #> 195 1.600 64.35 25.13672 #> 196 1.880 80.10 22.66297 #> 197 1.753 78.75 25.62635 #> 198 1.651 83.70 30.70657 #> 199 1.930 74.25 19.93342 #> 200 1.575 76.50 30.83900#> HWTGHTM HWTGWTK HWTGBMI_der #> 1 1.422 56.25 27.81784 #> 2 1.549 51.75 21.56788 #> 3 1.803 78.75 24.22474 #> 4 1.575 60.75 24.48980 #> 5 1.727 63.00 21.12301 #> 6 1.829 91.80 27.44197#> HWTGHTM HWTGWTK HWTGBMI_der #> 395 1.600 64.35 25.13672 #> 396 1.880 80.10 22.66297 #> 397 1.753 78.75 25.62635 #> 398 1.651 83.70 30.70657 #> 399 1.930 74.25 19.93342 #> 400 1.575 76.50 30.83900# Using bmi_fun() to generate a BMI value with user inputted height and # weight values. bmi_fun() can also generate a value for BMI if you input a # value for height and weight. Let's say your height is 170cm (1.7m) and # your weight is 50kg, your BMI can be calculated as follows: library(cchsflow) BMI <- bmi_fun(HWTGHTM = 1.7, HWTGWTK = 50) print(BMI)#> [1] 17.30104


{% include "header.html" %} Tab experiment name Type Text Text English Step Hidden Step {% include "main.html" %} {% include "footer.html" %}


I am a part-time working-undergrad pursuing a degree in Computer Science and Information Security. I work as freelance web developer/designer and have had experience in agile development cycles using scrum methodologies. Demonstrated leadership as the acting Secretary of the BMCC Programming Club 19-20 (Fall Semester) and the Vice-President of the BMCC Programming Club 19-20 (Spring Semester) organizing and hosting workshops and club projects.
My online portfolio website built and designed using HTML/CSS, JavaScript, SASS, JSON, and Bootstrap 4, which helped increase job offers for web development roles. Version control was utilized using Git and GitHub.
This project is an Actor/Performer/Photographer Portfolio website built and designed using HTML/CSS, JavaScript, SASS, JSON, and Bootstrap 4, which helped increase bookings for acting roles, photographer, and physical training. Version control was utilized using Git and GitHub.
This project was an info site for a gymnastics company based in Upstate New York. In this project, I lead a team of 3 developers, held conferences, and lead the design for the sitemap and website using HTML/CSS, JavaScript, Bootstrap 4, Python, and Flask. Integrated their JackRabbit API to automate schedule updates and online registering which helped increase students per classes. Agile Software Development implemented during the project and version control was utilized using Git and GitHub.
This website was the final project of a web development course I enrolled for on Udemy. During this project, I designed a sitemap and a mock-frame of a website, build a responsive website using HTML/CSS, JavaScript, jQuery and PHP, performed optimizations for site speed, search engine, and google analytics. Version control was utilized using Git and GitHub.
GPA: TBA
GPA: 3.64


Oguis Auto Repair
We Service All
Makes and Models
Whether your car is big or small, old or new, or foreign or domestic, we can fix it!
414.212.8679
Our expert staff services all types of vehicles in a timely manner. If you don't see your fix below, give us a call,<PHONE_NUMBER>, and we will surely help you gat back on the road!
MON-FRI: 8:00am - 5:00pm
SATURDAY: 9:00am - 3:00pm
SUNDAY: Closed
CALL US:
414.212.8679
Jose and Zular Rodríguez opened Oguis Auto Repair in 2007 and have since been servicing hundreds of customers in the Riverwest neighborhood. Jose takes care of the cars while Zular manages the day to day business operations.
The business is named Oguis as a tribute to Jose’s father in part to pay respect, as well as for personal meaning. The Rodríguezes’ have a close relationship with their community and are dedicated members of St. Robert’s Church. They have two beautiful children who both attend local Catholic schools. They enjoy being a part of the Milwaukee community and find it a great place to raise a family.
We welcome all inquiries about our services and are happy to answer any general questions you may have. You can always give us a call at<PHONE_NUMBER>. Lets get you back on the road!


Mobile computing: techniques that allow mobile users to use portable computing devices to run stand-alone applications and / or to access remote ones via wireless networks.
Challenges
How to ensure high data availability in mobile computing environment, where frequent disconnection may occur?
How to ensure desired level of consistency among the copies of data in servers and mobile devices, where battery power is limited?
Distinct characteristics of mobile wireless computing
Wireless communication
More frequent disconnection
Low and asymmetric bandwidth, high latency, high error rate
Greater variation in available bandwidth
Increased security risks
Mobility
Entities of mobility: physical (device), user (traveling people), process (mobile code)
Modes: personal/service/session/application
changes in physical/logical address & system configuration (network topology)
Location management problem: how does the network know where the intended recipient of a message is currently located?
Mobile device
screen/storage/battery life/variance in design and usage/more frequent breakdown and shorter lifespan
Wireless networks
WSAN Wireless Sensor Area Network
ZigBee: 250 kbit/s for embedded applications requiring low data rates and low power consumption
RFID
WPAN Wireless Personal Area Network ~10m
Infrared Data Association (IrDA), ~1m, 875 nm wavelength, 9600 bps to 4 Mbps, require line of sight
UWB Ultra-wide-band: 480Mbps ranging up to 30ft, for military radar systems
Bluetooth, ~10m, 720 Kbps, does not require line of sight
2400-2480 MHz
FHSS frequency-hopping spread spectrum: transmit chunks of data on up to 79 bands (1 MHz each; centered from 2402 to 2480 MHz), usually performs 800 hops per second
Bluetooth is a packet-based protocol with a master-slave structure. One master may communicate with up to 7 slaves in a piconet; all devices share the master’s clock.
1.2: data rate 1 Mbit/s, app throughput 0.7 Mbit/s
2.0+EDR: data rate 3 Mbit/s, app throughput 2.1 Mbit/s
3.0+HS; data rate 24 Mbit/s
Device ID (48 bit MAC address, unique worldwide)
master’s clock (28 bit, 3.2 kHz, 24hr per cycle)
all active device with 3-bit active member address (AMA)
parked devices cannot actively participate in the piconet but are known and can be reactivated. 8-bit parked member address (PMA). One slave has to switch to park mode if there are 7 active slaves and a parked device wants to communicate.
stand-by devices don’t participate
IEEE 802.15: WPAN standards
aims at standardizing MAC and physical layer (PHY) specifications of bluetooth
addresses coexistence with other wireless devices operating in unlicensed frequency bands
framework enabling interoperable, stable, and scalable wireless mesh networking
WLAN Wireless Local Area Network ~100m
802.11a,b,g,n (WiFi)
WMAN Wireless Metropolitan Area Network ~15km
802.16a,d (WiMAX)
Multimedia QoS: connection-oriented, not only connectionless based
WWAN Wireless Wide Area Network national coverage
Satellite global coverage, 2.4kbps-2Mbps
Mobility management
Handoff management
Hard handover: break-before-make
Soft handover: make-before-break
expensive hardware
Substantial interference due to near-far effect in CDMA networks without soft handovers.
2.5G: packet-switch systems, speed up to 144kbps, efficient spectrum utilization, always-on but not paying by-the-minutes, only software update from 2G, foundation of 3G infrastructure. GPRS 115kbps (practical 40kbps), CDMA2000 1x 144kbps (practical 40~56kbps)
3G: based on CDMA and IP, higher data rates 144kbps-2Mbps depending on the level of mobility, QoS. EDGE peak 384kbps, downlink 75-150kbps, CDMA2000 1x EV peak 2.4Mbps(EV-DO) 3Mbps(EV-DV), WCDMA 144kbps/384kbps/2Mbps for diff mobility. IMT 2000 industrial standard.
4G: 50-100Mbps, IPv6, QoS. 3GPP LTE: OFDM for downlink, adaptive modulation and coding, MIMO, all-IP, 100M down 50M up in 20 MHz spectrum, 5km~30km~100km coverage, up to 200 active users per cell (5 MHz), optimized for 0-15km/h but support high mobility, latency 5 ms user 50 ms control plane
Mobile Ad Hoc Network (MANET)
for low setup time, no infrastructure, pairwise connection of devices nearby
Characteristics: Lack of a centralized entity. Network topology changes frequently and unpredictably.
Mobile computing models
Mobile Client/Server
Simple C/S
Client/Agent/Server
complex client requests can be managed by agent with only the final result transmitted back to the client
server can offload some activities to agent (e.g. compression)
agent can cache results to improve performance
need to change client code to comm with agent
increased system overhead
Client/Intercept/Server
Think client: mostly for online access to web content; server side plays the main functional role; limited UI and capabilities on client side.
Smart client: allows working in occasionally connected env with offline access and resynchronization upon reconnection; both c/s have good capabilities; client incorporated mobile db tech for persistent data storage.
Mobile Peer-to-Peer. Hosts play the same role and cooperate to
Discover peers and resources
Route every requests
Perform specified tasks
Mobile Agent
Code mobility (with computation, data and state)
Autonomous and asynchronous
WAP Push
Push initiator, provides domain of Push Proxy Gateway and client address, comm with PPG using Push Access Protocol (on top of HTTP)
PPG uses OTA protocol (on top of HTTP or Wireless Session Protocol) to deliver content to WAP client, store the message, maintain status of each message, respond to PI using XML result notification indicating result of delivery
Service loading (URI to content to be cached, indicate whether content be exec immediately or just cached), service indication (message info or URI to it) and cache operation (remove obj from cache). SI and CO are optional.
Android is a software platform and operating system for mobile devices, based on the Linux kernel, developed by Google and later the Open Handset Alliance.
Mobile data management
Objectives
reducing the amount of data transmitted over wireless networks
reducing the response time of accessing data via wireless networks
providing data caching on mobile hosts
maintaining consistency of data and transactions
requirements for mobile databases: access to accurate & up-to-date information with constraints
some apps can tolerate bounded inconsistency sacrificing strict ACID (atomicity, consistency, isolation, durability) and allowing weaker consistent models
long disconnection should not constraint availability
Data aggregation in WSN
Center at Nearest Source
Shortest Path Tree
Greedy Incremental Tree
Mobile data dissemination
Goals
reduce access delay
minimizing energy consumption at client
maximize capacity of servers
approaches
pull-based (on-demand mode)
not scalable, limited by bandwidth for parallel pull requests
push-based (publish-subscribe mode)
scalable due to sequential access, so latency degrades with data volume
hybrid
access time: time interval between request from the device and reception of interested data item from broadcasting or data pushing or responding system. Dependent on number and size of the records to be broadcast.
Tuning time: time interval between the mobile unit gets ready and a desired record is broadcast, i.e., the time MU spent listening actively to the channel. Power consumption proportional to t_tune.
broadcast disk
item-based program is expensive to generate with large # of items
collect items of similar access probability into partitions (disks)
objectives
allow mobile users to access broadcast data with optimal access time and power consumption
determine how to organize the data items and schedule the time of broadcast
determine how MUs should retrieve and process the broadcast data items on air
Flat disk model: round-robin, equal priority, no consideration on # of subscription to a particular record.<PHONE_NUMBER>23
Circular multi-disk model: block of records is pushed with a repetition rate proportional to its hierarchical level, disks with same rotation speed, higher level disks with less number of records repeated more times.
Multi-disk model with repetition rate proportional to priority: still same rotation speed but repetition rate of a record is proportional to its priority level, popular records are assigned to multiple levels.<PHONE_NUMBER>02
Skewed disk model: block of records are repeated as per their priorities for pushing, thus entailing consecutive repeated transmission of a record block followed by consecutive transmission of another block.<PHONE_NUMBER>12
Selective tuning
MU activates only when the data arrives, saving power
with the help of directory or index
Directory: overhead at beginning of each cycle, consisting of start sign, pointers to records and end sign. A device wait for directory before it can get tuned.
index: can be broadcast interleaved with data records. Relatively small containing only key names. offset maps to the beginning of next index
(1,m) indexing: broadcast the index every fraction 1/m of the data items; all data items have an offset to the beginning of the next indexed data item
Distributed indexing: replicate not the whole index but only those immediately follow the index segment. 2 levels, repeated and unrepeated.
extends broadcast cycle and increase t_access
Mobile data caching
Goal: Cache the most probable data item for best future use, given limited amount of cache storage and potential changes in data item values.
Performance: hit ratio, access response time, energy cost
Correctness: consistency
Cache invalidation:
When? synchronous or asynchronous
To whom? stateful or stateless servers
What? invalidation with only an update notification or propagation with the new values or aggregated information/views
Polling (client-initiated)
TTL: polls after TTL expiration. TTL=0 equivalent to polling
Pushing (server-initiated)
Stateless asynchronous
no frequent unnecessary reports, more bandwidth efficient
clients get the report regardless of its requirement, client mistaken invalid data as valid if a report is missing
Stateless synchronous (client requests if no report in a period)
greater reliability, better consistency
unnecessary transfers of invalidation reports periodically, potential inconsistent data between two reports
Stateful asynchronous
only affected clients receive reports
client still presume that as long as there is no invalidation report, the copy is valid, leading to invalid data
Stateful synchronous
timely synchronization
high bandwidth requirement
Cooperative caching in multi-hop wireless internet access
challenges
Multi-hop reachability from data source
Bandwidth constraints
Disconnection
Topology changes and peer dynamism
Resource constraints on mobile nodes
issues: cache placement, discovery and consistency
Weak consistency: best-effort guarantee
Delta consistency: deviation in values or time bounded by \delta
Probabilistic consistency: guarantee given consistency level with specified probability p
Disconnected operations
A mode of operation that enables a client to continue accessing critical data maintained at the server during temporary interruption of network connection
the extreme of weakly connected operation (low radio signal, intermittent connectivity, noisy channel), can be involuntary or voluntary
Why? battery life, network charge, radio silence (vital for military applications)
objectives
ensure data availability even under disconnection
tradeoff between data consistency and autonomy of client
How? Caching, Prefetching: cache items that may be useful in future but not currently needed, utilizing the otherwise idle processing power or bandwidth, Hoarding: prefetching to prepare for disconnection
Client states: connected (request satisfied from either local cache or server), disconnected (all requests must be satisfied from local cache) and reintegration (update related info, deal with conflicts)
consistency
strong consistency requires atomic updates, which is difficult to achieve in mobile environments
transparent replication: allowing systems that were developed to run on a central server to operate unchanged on top of a strongly-consistent replicated data storage. Oceanstore
Non-transparent replication: allowing systems to be developed assuming a relaxed consistency model. Therefore applications are involved in conflict detection and resolution. The challenge is to provide the right interface to support cooperation between apps and their data managers.
Bayou: a replicated weakly consistent storage system designed for mobile computing environment. User can read and write any accessible replica. Application-specific conflict detection and resolution method. Dependency check and merge procedure on write operation. Eventual consistency due to 1 writes are performed at all servers in the same order; 2 conflict detection and merge procedures are deterministic. Anti-entropy protocol for propagating writes among servers (pairwise propagation, all replicas receive all updates).
Coda filesystem from CMU: providing constant availability through replication; introducing a disconnected mode for portable computers (which makes Coda different from AFS).
cache whole file whenever possible, callback based
automate the portable computer model, auto-syn feature
Use server replication to improve scalability, read from any server, write to all servers.
disconnected mode: Venus emulates the server, logs updates locally in Client Modification Log
hoarding to let users keep important files in their hoard database
Upon reconnection: enters data reintegration state, Venus integrates locally changed files to servers. Does not prevent inconsistent updates but guarantees that inconsistent updates will always be detected and then apply user conflict resolution.
Andrew File System (AFS): adopts upload/download model; whole file transferred to and cached in client sites. callback promise token. Write-on-close. Only final close operation retain all updates it makes. AFS servers are stateful.
Location-dependent index and query
3 key elements of location-dependent applications
location-dependent queries: result depend on the location of the origin of the query or the object being queried for
locations: obtained by mobile positioning tech, maintained by spatial databases
location-dependent database
location representation: geometric (n-dimension coordinate) or symbolic (logical real-world description)
spatial data: data representing (location of a road) or associated with locations (name or speed limit of that road)
discrete or continuous
vector data model using points as basis to model lines, areas and so on or raster data model using grid to represent spatial feature. Generalized raster model called tessellation model, in which elements can be of arbitrary shapes.
spatial queries
new operators: containment, overlap, neighbor, spatial relationship (to the left of, etc.), spatial join
typical queries: range query for objects with an area, nearest neighbor, k-nearest neighbors
location-dependent queries (what’s more than spatial queries)
client may move and be part of the query, result depend on direction of movement
may not directly contain location info but may have multiple values corresponding to different locations
temporal features (gas stations in the next 20 min)
indexing
allow direct access to tuples satisfying the condition
mostly based on hash-table (for point query) and B-tree/B^+-tree
In practice, B^+-trees, allowing sequential access to range data by chaining together leaf nodes.
indexing spatial data
partition the set of objects into subsets according to their locations
R-tree, R^*-tree, R^+-tree (2-D equivalence of B-trees)
R-tree: minimum bounding box, mbb can overlap
for point(range) search, check the mbb of each branch, if the mbb contains(intersects with) the query, search recursively down the sub-branches
complicated insertion
R^*-tree with some optimizations for insertion
R^+ tree
mbb at the same level do not overlap
object may have to be duplicated
higher storage overhead, more complicated insertion, faster searching
moving object database
costly insertion, even worse for moving objects
trade-off: precision v.s. update efficiency
indexing time dimension
3D-R-tree for historical trajectories as 3d minimum bounding rectangle (MBR), simple but not scalable, no efficient query support
multi-version: nodes unchanged are linked
Continuous query. Caching and prediction are useful.


Lara Croft: Tomb Raider Reviewed by Christian Pyle Directed by Simon West Written by Patrick Massett and John Zinman (based on the video game) Starring Angelina Jolie, Iain Glen, and Jon Voight Grade: F
You'd think that after awhile Hollywood would stop trying to make movies out of video games. It hasn't worked so far. "Street Fighter?" "Super Mario Brothers?" "Wing Commander?" "Mortal Kombat?" Not a watchable film in the bunch. Still I held out some hope for "Tomb Raider." After all, the game's premise is heavily influenced by the Indiana Jones trilogy and all the mummy movies, so there are cinematic elements imbedded in the concept. However, despite the potential of the project, "Tomb Raider" proves to be yet another bomb.
The plot is a convoluted accumulation of nonsense probably borrowed from a dozen bad movies. There's a once-ever-5000-years alignment of planets coming up, and the Illuminati have to find both halves of an ancient triangle that controls time in order to take over the world. Of course, the ancient folks who divided the triangle buried the halves in tombs on opposite sides of the world. Our heroine, Lady Lara Croft (Angelina Jolie), finds the key that opens the tombs in relics that her dead father (Jon Voight) dug up. She figures that if she gets the triangle, she can bring her dad back from the dead.
Of course, no one was expecting much of a plot from this movie anyway. In both video games and action movies, the plot is just an excuse for the action sequences. However, the action in "Tomb Raider" shows little style or originality. There's lots of shooting and some kung fu fightin', but none of it progresses beyond the level of a cheap direct-to-cable flick. The other goofy archeologist flick of the summer, "The Mummy Returns," was much better; it had its flaws, but its action was creative and large-scale.
Since winning her Academy Award for "Girl, Interrupted," Jolie hasn't taken any projects that would display her acting talents. "Tomb Raider" seems to be more interested in displaying her breasts; so much attention is drawn to them that it's a shame there's no Oscar for Best Performance by a Wonderbra.
While we don't see much of her acting ability (with the exception of a wonderful upper-crust British accent), we do get a hint of Jolie's less savory side. Considering the rumors of incest that hang over Jolie and her supposed obsession with death, having Lara be obsessed with resurrecting her dead father (and uninterested in any of the living males around her) seems a poor choice. Having Jolie's real life father Jon Voight play the dead dad makes it even creepier.
I haven't decided what to make of director Simon West yet. His first feature was the star-studded disaster "Con Air," but my opinion of him improved with "The General's Daughter," which was thick with sultry atmosphere. Now this train wreck. I hope he improves again because his next project is the big screen version of the cult TV series "The Prisoner." Hollywood has already screwed up "The Avengers," and "The Prisoner" represents a chance for redemption.
(By the way, speaking of British TV, "Red Dwarf" fans should look for Chris "Rimmer" Barrie in his first major film role).
Bottom Line: Best left in the tomb
© 2001 Christian L. Pyle
Read my reviews and others at the Mad Review: http://www.madreview.com/main.html
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


{% extends "main/base.html" %} {% block content %}
| Company | {{ object.order_approval_number }} |
|---|---|
| Order Approval Number | {{ object.order_approval_number }} |
| Established At | {{ object.established_at }} |
| Approved At | {{ object.approved_at }} |
| Commisioner no. 1 | {{ object.commisioner_1 }} |
| Commisioner no. 2 | {{ object.commisioner_2 }} |
| Commisioner no. 3 | {{ object.commisioner_3 }} |
| Commisioner no. 4 | {{ object.commisioner_4 }} |
| Location | {{ object.responsible_user.location }} |
| Purchase Doc. Seller | {{ object.purchase_doc_seller }} |
| Purchase Doc. Number | {{ object.purchase_doc_number }} |
| Purchase Doc. Serial | {{ object.purchase_doc_serial }} |
| Purchase Doc. At | {{ object.purchase_doc_at }} |
| Responsible Worker | {{ object.responsible_user.name }} {{ object.responsible_user.surname }} |
Not found any VAT invoice
{% endif %} View in PDF Add VAT Invoice {% endblock content %}


View source code
Display the source code in std/traits.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Module std.traits
Templates which extract information about types and symbols at compile time.
Functions
| Name | Description |
|---|---|
lvalueOf
|
Creates an lvalue or rvalue of type T for typeof(...) and
_traits(compiles, ...) purposes. No actual value is returned.
|
rvalueOf
|
Creates an lvalue or rvalue of type T for typeof(...) and
_traits(compiles, ...) purposes. No actual value is returned.
|
select
|
If cond is true , returns without evaluating . Otherwise, returns without evaluating .
|
Enums
| Name | Description |
|---|---|
FunctionAttribute
|
Returns the attributes attached to a function func .
|
ParameterStorageClass
|
Returns a tuple consisting of the storage classes of the parameters of a
function func .
|
Variadic
|
Determines what kind of variadic parameters function has. |
Templates
| Name | Description |
|---|---|
areAllSafe
|
Deprecated. It's badly named and provides redundant functionality. It was
also badly broken prior to 2.060 (bug# 8362), so any code which uses it
probably needs to be changed anyway. Please use allSatisfy(
instead. This will be removed in June 2015.
|
BaseClassesTuple
|
Get a TypeTuple of all base classes of this class,
in decreasing order. Interfaces are not included. BaseClassesTuple !Object yields the empty type tuple.
|
BaseTypeTuple
|
Get a TypeTuple of the base class and base interfaces of
this class or interface. BaseTypeTuple !Object returns
the empty type tuple.
|
CommonType
|
Get the type that all types can be implicitly converted to.  Returns void if passed an empty list, or if the types have no common type. |
FieldNameTuple
|
Get as an expression tuple the names of the fields of a struct, class, or
union. This consists of the fields that take up memory space, excluding the
hidden fields like the virtual function table pointer or a context pointer
for nested types. If T isn't a struct, class, or union returns an
expression tuple with an empty string.
|
FieldTypeTuple
|
Get as a typetuple the types of the fields of a struct, class, or union.
This consists of the fields that take up memory space,
excluding the hidden fields like the virtual function
table pointer or a context pointer for nested types.
If T isn't a struct, class, or union returns typetuple
with one element T .
|
fullyQualifiedName
|
Get the fully qualified name of a type or a symbol. Can act as an intelligent type/symbol to string converter. |
FunctionTypeOf
|
Get the function type from a callable object func .
|
hasAliasing
|
Returns true if and only if T 's representation includes at
least one of the following:
|
hasElaborateAssign
|
True if S or any type directly embedded in the representation of S
defines an elaborate assignment. Elaborate assignments are introduced by
defining opAssign(typeof(this)) or opAssign(ref typeof(this))
for a struct or when there is a compiler-generated opAssign .
|
hasElaborateCopyConstructor
|
True if S or any type embedded directly in the representation of S
defines an elaborate copy constructor. Elaborate copy constructors are
introduced by defining this(this) for a struct .
|
hasElaborateDestructor
|
True if S or any type directly embedded in the representation
of S defines an elaborate destructor. Elaborate destructors
are introduced by defining ~this() for a struct .
|
hasIndirections
|
Returns true if and only if T 's representation includes at
least one of the following:
|
hasMember
|
Yields true if and only if T is an aggregate that defines
a symbol called name .
|
hasNested
|
Determines whether T or any of its representation types
have a context pointer.
|
hasUnsharedAliasing
|
Returns true if and only if T 's representation includes at
least one of the following:
|
ImplicitConversionTargets
|
Returns a tuple with all possible target types of an implicit conversion of a value of type T. |
InterfacesTuple
|
Get a TypeTuple of all interfaces directly or
indirectly inherited by this class or interface. Interfaces do not
repeat if multiply implemented. InterfacesTuple !Object
yields the empty type tuple.
|
isCallable
|
Detect whether T is a callable object , which can be called with the
function call operator (...) .
|
isCovariantWith
|
Determines whether the function type F is covariant with G , i.e.,
functions of the type F can override ones of the type G .
|
isDelegate
|
Detect whether symbol or type T is a delegate.
|
isExpressionTuple
|
Check whether the tuple T is an expression tuple. An expression tuple only contains expressions. |
isFunctionPointer
|
Detect whether symbol or type T is a function pointer.
|
isSomeFunction
|
Detect whether symbol or type T is a function, a function pointer or a delegate.
|
isTypeTuple
|
Check whether the tuple T is a type tuple.
A type tuple only contains types.
|
Largest
|
Returns the largest type, i.e. T such that T.sizeof is the largest. If more than one type is of the same size, the leftmost argument of these in will be returned. |
mangledName
|
Returns the mangled name of symbol or type sth .
|
MemberFunctionsTuple
|
Returns a tuple of non-static functions with the name name declared in the
class or interface C . Covariant duplicates are shrunk into the most
derived one.
|
moduleName
|
Get the module name (including package) for the given symbol. |
mostNegative
|
Returns the most negative value of the numeric type T. |
packageName
|
Get the full package name for the given symbol. |
ParameterTypeTuple
|
Get, as a tuple, the types of the parameters to a function, a pointer
to function, a delegate, a struct with an opCall , a pointer to a
struct with an opCall , or a class with an opCall .
|
RepresentationTypeTuple
|
Get the primitive types of the fields of a struct or class, in topological order. |
ReturnType
|
Get the type of the return value from a function,
a pointer to function, a delegate, a struct
with an opCall, a pointer to a struct with an opCall,
or a class with an opCall . Please note that ref
is not part of a type, but the attribute of the function
(see template functionAttributes ).
|
SetFunctionAttributes
|
Constructs a new function or delegate type with the same basic signature as the given one, but different attributes (including linkage). |
TransitiveBaseTypeTuple
|
Get a TypeTuple of all base classes of T, in decreasing order, followed by T's
interfaces. TransitiveBaseTypeTuple !Object yields the
empty type tuple.
|
Unqual
|
Removes all qualifiers, if any, from type T .
|
Enum values
| Name | Type | Description |
|---|---|---|
arity
|
Returns the number of arguments of function func .
arity is undefined for variadic functions.
|
|
functionAttributes
|
Returns the attributes attached to a function func .
|
|
functionLinkage
|
Returns the calling convention of function as a string. | |
isAbstractClass
|
Detect whether T is a an abstract class.
|
|
isAbstractFunction
|
Detect whether T is a an abstract function.
|
|
isAggregateType
|
Detect whether type T is an aggregate type.
|
|
isArray
|
Detect whether type T is an array (static or dynamic; for associative
arrays see isAssociativeArray ).
|
|
isAssignable
|
Returns true iff a value of type Rhs can be assigned to a variable of
type Lhs .
|
|
isAssociativeArray
|
Detect whether T is an associative array type
|
|
isBasicType
|
Detect whether T is a basic type (scalar type or void).
|
|
isBoolean
|
Detect whether T is a built-in boolean type.
|
|
isBuiltinType
|
Detect whether type T is a builtin type.
|
|
isDynamicArray
|
Detect whether type T is a dynamic array.
|
|
isFinalClass
|
Detect whether T is a a final class.
|
|
isFinalFunction
|
Detect whether T is a a final function.
|
|
isFloatingPoint
|
Detect whether T is a built-in floating point type.
|
|
isImplicitlyConvertible
|
Is From implicitly convertible to To ?
|
|
isInstanceOf
|
Returns true if T is an instance of the template S. | |
isIntegral
|
Detect whether T is a built-in integral type. Types bool ,
char , wchar , and dchar are not considered integral.
|
|
isIterable
|
Returns true if T can be iterated over using a foreach loop with
a single loop variable of automatically inferred type, regardless of how
the foreach loop is implemented. This includes ranges, structs/classes
that define opApply with a single loop variable, and builtin dynamic,
static and associative arrays.
|
|
isMutable
|
Returns true if T is not const or immutable. Note that isMutable is true for
string, or immutable(char)[], because the 'head' is mutable.
|
|
isNested
|
Determines whether T has its own context pointer.
T must be either class , struct , or union .
|
|
isNestedFunction
|
Determines whether function f requires a context pointer.
|
|
isNumeric
|
Detect whether T is a built-in numeric type (integral or floating
point).
|
|
isPointer
|
Detect whether type T is a pointer.
|
|
isSafe
|
true if func is @safe or @trusted .
|
|
isScalarType
|
Detect whether T is a scalar type (a built-in numeric, character or boolean type).
|
|
isSigned
|
Detect whether T is a built-in signed numeric type.
|
|
isSIMDVector
|
Detect whether type T is a SIMD vector type.
|
|
isSomeChar
|
Detect whether T is one of the built-in character types.
|
|
isSomeString
|
Detect whether T is one of the built-in string types.
|
|
isStaticArray
|
Detect whether type T is a static array.
|
|
isUnsafe
|
true if func is @system .
|
|
isUnsigned
|
Detect whether T is a built-in unsigned numeric type.
|
|
variadicFunctionStyle
|
Determines what kind of variadic parameters function has. |
Aliases
| Name | Type | Description |
|---|---|---|
classInstanceAlignment
|
maxAlignment!(void*,typeof(T.tupleof))
|
Returns class instance alignment. |
EnumMembers
|
EnumSpecificMembers!(__traits(allMembers,E))
|
Retrieves the members of an enumerated type enum E .
|
ForeachType
|
ReturnType!(typeof((inoutintx=0){foreach(elem;T.init){returnelem;}assert(0);}))
|
Returns the inferred type of the loop variable when a variable of type T
is iterated over using a foreach loop with a single loop variable and
automatically inferred return type. Note that this may not be the same as
std.range.ElementType!Range in the case of narrow strings, or if T
has both opApply and a range interface.
|
KeyType
|
K
|
Get the Key type of an Associative Array. |
OriginalType
|
ModifyTypePreservingSTC!(Impl,T)
|
Strips off all enum s from type T .
|
ParameterDefaultValueTuple
|
Impl!()
|
Get, as a tuple, the default value of the parameters to a function symbol.
If a parameter doesn't have the default value, void is returned instead.
|
ParameterIdentifierTuple
|
Impl!()
|
Get, as a tuple, the identifiers of the parameters to a function symbol. |
ParameterStorageClassTuple
|
demangleNextParameter!margs
|
Returns a tuple consisting of the storage classes of the parameters of a
function func .
|
pointerTarget
|
Deprecated. Please use PointerTarget instead. This will be
removed in June 2015.
|
|
PointerTarget
|
T
|
Returns the target type of a pointer. |
Select
|
T[!condition]
|
Aliases itself to T[0] if the boolean condition is true
and to T[1] otherwise.
|
SetFunctionAttributes
|
FunctionTypeOf!(SetFunctionAttributes!(T*,linkage,attrs))
|
Constructs a new function or delegate type with the same basic signature as the given one, but different attributes (including linkage). |
Signed
|
ModifyTypePreservingSTC!(Impl,OriginalType!T)
|
Returns the corresponding signed type for T. T must be a numeric integral type, otherwise a compile-time error occurs. |
TemplateArgsOf
|
Args
|
Returns a TypeTuple of the template arguments used to instantiate T .
|
TemplateOf
|
Base
|
Returns an alias to the template that T is an instance of.
|
Unsigned
|
ModifyTypePreservingSTC!(Impl,OriginalType!T)
|
Returns the corresponding unsigned type for T. T must be a numeric integral type, otherwise a compile-time error occurs. |
ValueType
|
V
|
Get the Value type of an Associative Array. |
Authors
Walter Bright,
Tomasz Stachowiak (
),
Andrei Alexandrescu,
Shin Fujishiro,
Robert Clipsham,
David Nadlinger,
Kenji Hara,
Shoichi Kato
isExpressionTuple


rtl_heatmap - Spectrum viewer
This website loads CSV files, generated by the rtl_power utility and displays them. This can take quite some time for larger files on slow machines. Please be patient and use the latest
Chrome or
Firefox Browser.
To begin click the "Open CSV" button and enjoy the show :)


--- title: "Three ways to compute a Bayes factor" date: 2021-03-28 tags: ["R","Stan","Bayes Factor"] ---
This post was inspired by a very interesting paper on Bayes factors: Workflow Techniques for the Robust Use of Bayes Factors by Schad, Nicenboim, Bürkner, Betancourt and Vasishth. I would specifically recommend it for its introduction into what actually is a hypothesis in the Bayesian context and insights into what Bayes factors are.
I wrote this post test my understanding of the material - the logic of Bayes factors implies that there are multiple ways to compute the same Bayes factor, each providing a somewhat different intuition on how to interpret them. So we’ll see how we can compute the Bayes factor using a black-box ready-made package, then get the same number analytically via prior predictive density and the get the same number by writing a “supermodel” that includes both the individual models we are comparing.
We’ll do less math and theory here, anyone who prefers math first, examples later or wants a deeper dive into the theory should start by reading the paper.
We will fit a few models with the newer R interface for Stan CmdStanR and with brms.
library(cmdstanr)
library(brms)
library(tidyverse)
library(knitr)
ggplot2::theme_set(cowplot::theme_cowplot())
options(mc.cores = parallel::detectCores(), brms.backend = "cmdstanr")
document_output <- isTRUE(getOption('knitr.in.progress'))
if(document_output) {
table_format <- knitr::kable
} else {
table_format <- identity
}
Note on notation: I tried to be consistent and use plain symbols (\(y_1, z, ...\)) for variables, bold symbols (\(\mathbf{y}, \mathbf{\Sigma}\)) for vectors and matrices, \(P(A)\) for the probability of event \(A\) and \(p(y)\) for the density of random variable.
We will keep stuff very simple. Our first contestant, the humble null model a.k.a. \(\mathcal{M}_1\) will be that the \(K\) data points are independent draws from a standard normal distribution, i.e.:
\[ \mathcal{M}_1 : \mathbf{y} = \{y_1, ... , y_K\} \\ y_i \sim N(0,1) \] In code, simulating from such a model this would look like:
N <- 10 # Size of dataset
y <- rnorm(N, mean = 0, sd = 1)
The null model has faced a lot of rejection in their whole life, but has kept its spirit up despite all the adversity. But will it be enough?
The challenger will be the daring intercept model a.k.a. the destroyer of souls a.k.a. \(\mathcal{M}_2\) that posits that there is an unknown, almost surely non-zero mean of the normal distribution, i.e.:
\[ \mathcal{M}_2: \mathbf{y} = \{y_1, ... , y_K\} \\ y_i \sim \alpha + N(0, 1) \\ \alpha \sim N(0,2) \]
The corresponding R code would be:
N <- 10 # Size of dataset
alpha <- rnorm(1, 0, 2)
y <- rnorm(N, mean = alpha, sd = 1)
This comparison is basically the Bayesian alternative of a single sample t-test with fixed variance - so very simple indeed.
Finally let’s prepare some data for our contestants to chew on:
y <- c(0.5,0.7, -0.4, 0.1)
We will start by where most users probably start: invoking a statistical package to compute the Bayes factor.
Here we will use the hypothesis
function from brms
which uses the Savage-Dickey method under the hood.
For this, we note that the null model is just a special case of the intercept model, destroyer of suns.
So let us fit this model (\(\mathcal{M}_2\)) in brms
. We will be using a lot of samples to reduce estimator error
as Bayes factors can be quite sensitive.
cache_dir <- "_bf_cache"
if(!dir.exists(cache_dir)) {
dir.create(cache_dir)
}
fit_brms <- brm(y ~ 0 + Intercept, # `0 + Intercept` avoids centering
prior =
c(prior(normal(0,2), class = b), # Our prior on intercept
prior(constant(1), class = sigma)), # Fix sigma to a constant
data = data.frame(y = y),
iter = 10000,
sample_prior = "yes", # Needed to compute BF
refresh = 0, silent = TRUE,
file = paste0(cache_dir, "/fit"), # Cache the results
file_refit = "on_change")
Hypothesis then gives us two numbers, the Bayes factor of null over intercept (\(BF_{12}\)), a.k.a. evidence ratio and the posterior probability that null model generated the data \(P(\mathcal{M}_1 | \mathbf{y})\):
hyp_res <- hypothesis(fit_brms, "Intercept = 0")
bf_brms <- hyp_res$hypothesis$Evid.Ratio
prob_null_brms <- hyp_res$hypothesis$Post.Prob
res_brms <- data.frame(method = "brms", bf = bf_brms, prob_null = prob_null_brms)
res_brms %>% table_format
| method | bf | prob_null |
|---|---|---|
| brms | 3.725066 | 0.7883628 |
Those two qunatities happen to share a pretty straightforward relationship, given the prior probabilities of the individual models \(P(\mathcal{M}_1)\), \(P(\mathcal{M}_2)\) i.e.:
\[
P(\mathcal{M}_1 | \mathbf{y}) = \frac{BF_{12}P(\mathcal{M}_1)}{BF_{12}P(\mathcal{M}_1) + BF_{22}P(\mathcal{M}_2)} = \\
=
\frac{BF_{12}P(\mathcal{M}_1)}{BF_{12}P(\mathcal{M}_1) + P(\mathcal{M}_2)}
\]
Where \(BF_{22} = 1\) is the Bayes factor of the intercept model, cruel queen of the damned, against itself.
If the prior is uniform, i.e. \(P(\mathcal{M}_1) = P(\mathcal{M}_2)\) - as is assumed by brms
- the formula further simplifies to:
\[ P(\mathcal{M}_1 | \mathbf{y}) = \frac{BF_{12}}{BF_{12} + 1} \]
The Bayes factor might look a bit like a magic number, so let us demystify it with two more transparent approaches that give us the same Bayes factor.
One way to define Bayes factor is as the ratio of evidence i.e.:
\[ BF_{12} = \frac{P(\mathbf{y} | \mathcal{M}_1)}{P(\mathbf{y} | \mathcal{M}_2)} \]
Where “evidence” is exactly the prior density of the data after integrating out all the parameters. Since we have chosen very simple models, there is an analytic formula for evidence for both models.
As is usually done for numerical stability, we will primarily operate on the log scale. Computing the evidence for the null model is straightforward - there are no parameters to integrate out, so we can directly compute:
prior_log_evidence_null <- sum(dnorm(y, mean = 0, sd = 1, log = TRUE))
prior_log_evidence_null
## [1] -4.130754
The evidence for the intercept model, prophet of the apocalypse, is slightly more involved. The main idea is that we can see the data as sum of two multivariate normals, one with perfect correlation (corresponding to \(K\) identical copies of \(\alpha\)) and one with no correlation (corresponding to noise):
\[ \mathcal{M}_2: \mathbf{y} = \mathbf{a} + \mathbf{e} \\ \mathbf{a} \sim MVN(0, \mathbf{\Sigma_a}), \forall_{i,j \in \{1, .., K\}} \Sigma_{a;i,j} = Var(\alpha) = 4 \\ \mathbf{e} \sim MVN(0, \mathbf{\Sigma_e}), \mathbf{\Sigma_{e}} = I \\ \]
where \(\mathbf{\Sigma_a}\) is a matrix with all elements set to \(Var(\alpha) = 4\) and \(\mathbf{\Sigma_e}\) is the identity matrix (1 on diagonal, 0 elsewhere). From the properties of multivariate normal we know that a sum of multivariate normals is obtained by simply adding both means and covariance matrices together, i.e.:
\[ \mathcal{M}_2: \mathbf{y} \sim MVN(0, \mathbf{\Sigma}) \\ \forall_{i \in \{1, .., K\}}\mathbf{\Sigma}_{i,i} = 5 \\ \forall_{i \neq j \in \{1, .., K\}} \mathbf{\Sigma}_{i,j} = 4 \]
where \(\mathbf{\Sigma} = \mathbf{\Sigma_a} + \mathbf{\Sigma_e}\). With that we can compute the evidence for the intercept model, the harbinger of sorrow, \(P(\mathbf{y} | \mathcal{M}_2)\) as the corresponding multivariate normal density:
prior_Sigma <- diag(length(y)) + matrix(4, nrow = length(y), ncol = length(y))
prior_log_evidence_intercept <-
mvtnorm::dmvnorm(y, mean = rep(0, length(y)), sigma = prior_Sigma, log = TRUE)
prior_log_evidence_intercept
## [1] -5.452067
The Bayes factor is then simply the ratio of the evidence and we can use the BF to compute the posterior probability of the null model, assuming once again uniform prior.
bf_prior <- exp(prior_log_evidence_null - prior_log_evidence_intercept)
prob_null_prior <- bf_prior / (bf_prior + 1)
res_prior <- data.frame(method = "prior", bf = bf_prior, prob_null = prob_null_prior)
rbind(res_prior, res_brms) %>% table_format
| method | bf | prob_null |
|---|---|---|
| prior | 3.748338 | 0.7894000 |
| brms | 3.725066 | 0.7883628 |
We see the results happen to match pretty closely with the value obtained via brms
.
The difference can be attributed to sampling error in the brms
computation.
The perspective via prior predictive distribution lays bare why the Bayes factor is so sensitive to choice of priors - priors are quite literally the only thing that matters. We may also note that in computing the Bayes factor we decide to not use the data to inform the parameters of the model. This might be desirable for people who really fear “double dipping” - it makes some sense to test two competing hypothesis without letting the data inform either of the models. But it IMHO only makes sense when your hypotheses are precise enough (i.e. have narrow priors) that you don’t really need additional data to constrain them.
If your priors are wide and your hypotheses imprecise, Bayes factor may not give you anything useful (as is neatly shown in the Schad et al. paper, which you should read).
A third perspective is provided by imagining a “supermodel” combining our two contestants, i.e.:
\[ \mathcal{M}_{super}: \mathbf{y} = \{y_1, ... , y_K\} \\ z \in \{1,2\}; P(z = 1) = P(z = 2) = \frac{1}{2}\\ y_i \sim N(\mu, 1) \\ \mu = \begin{cases} 0 & \mathrm{if} \quad z = 1 \\ \alpha & \mathrm{if} \quad z = 2 \end{cases} \\ \alpha \sim N(0,2) \] So we have introduced a new random variable \(z\) that works as an index over the two models and gave it a discrete uniform prior.
If we fit this model to the data, then \(P(\mathcal{M}_1 | \mathbf{y}) = P(z = 1 | \mathbf{y})\), so we can use the fitted distribution of \(z\) to get the posterior probability of the models which (as shown above) we can transform into a Bayes factor.
Before showing how to do this in Stan, we can use JAGS to implement this model very directly, if not very efficiently:
suppressPackageStartupMessages(library(rjags))
## Warning: package 'rjags' was built under R version 4.0.4
## Warning: package 'coda' was built under R version 4.0.4
data_list <- list(
y = y)
# The model specification, note that JAGS uses precision
# to parametrize normal distribution
# Additionally we have z_0 = z - 1
jags_model_string <- "model {
z_0 ~ dbern(0.5)
alpha ~ dnorm(0, 0.25)
for(i in 1:length(y) ) {
mu[i] = ifelse(z_0 == 0, 0, alpha)
y[i] ~ dnorm(mu[i], 1)
}
}"
params_to_monitor <- c("z_0", "alpha")
# Running the model
model <- jags.model( textConnection(jags_model_string), data_list,
n.chains = 4, n.adapt= 1000)
## Compiling model graph
## Resolving undeclared variables
## Allocating nodes
## Graph information:
## Observed stochastic nodes: 4
## Unobserved stochastic nodes: 2
## Total graph size: 12
##
## Initializing model
update(model, 1000); # Burning 1000 samples to the MCMC gods...
mcmc_samples <- coda.samples(model, params_to_monitor, n.iter=10000, thin = 10)
# Extract values and check diagnostics
alpha_array <- cbind(mcmc_samples[[1]][, "alpha"], mcmc_samples[[2]][, "alpha"],
mcmc_samples[[3]][, "alpha"], mcmc_samples[[4]][, "alpha"])
posterior::rhat(alpha_array)
## [1] 0.9997451
posterior::ess_bulk(alpha_array)
## [1] 3933.771
z_array <- cbind(mcmc_samples[[1]][, "z_0"], mcmc_samples[[2]][, "z_0"],
mcmc_samples[[3]][, "z_0"], mcmc_samples[[4]][, "z_0"])
posterior::rhat(z_array)
## [1] 1.000557
posterior::ess_bulk(z_array)
## [1] 4013.534
Posterior probability of the data being from the null model (\(P(\mathcal{M}_1 | \mathbf{y})\)), is then simply the \(P(z = 1 | \mathbf{y}) = P(z_0 = 0 | \mathbf{y})\) which can be directly extracted from the samples.
prob_null_jags <- mean(z_array == 0)
bf_jags <- prob_null_jags / (1 - prob_null_jags)
res_jags <- data.frame(method = "super_jags", bf = bf_jags,
prob_null = prob_null_jags)
rbind(res_jags, res_prior, res_brms) %>% table_format()
| method | bf | prob_null |
|---|---|---|
| super_jags | 3.950495 | 0.7980000 |
| prior | 3.748338 | 0.7894000 |
| brms | 3.725066 | 0.7883628 |
We once again see a good agreement.
But we obviously want to do this in Stan. But Stan doesn’t handle discrete parameters you say? This can be overcome!
Warning: I had a lot of trouble thinking clearly about the rest of this section, so it is possible, there are mistakes or stuff is confusing. Please let me know, if you find the reasoning problematic/unclear/unconvincing.
The important point is called marginalization and there is a neat intro to it in the preprint for the rater
package. More discussion and examples are in the Stan User’s guide. The point is that we can express the unnormalized density \(p(\alpha, \mathbf{y})\) as:
\[ \mathcal{M}_{super-marginalized}: \\ p(\alpha, \mathbf{y}) = p(\alpha)p(\mathbf{y}| \alpha) \\ p(\mathbf{y}| \alpha) = p(\mathbf{y} | \alpha, z = 1)p(z = 1) + p(\mathbf{y} | \alpha, z = 1)p(z = 0) \] Now we have a density for \(y\) that is a combination of two normal densities and does not have \(z\) as a free parameter and can thus be written in Stan as:
cat(readLines("2021-bayes-factors.stan"), sep = "\n")
data {
int K;
vector[K] y;
}
parameters {
real alpha;
}
transformed parameters {
real log_lik_null = normal_lpdf(y | 0, 1);
real log_lik_intercept = normal_lpdf(y | alpha, 1);
}
model {
target += log_mix(0.5, log_lik_null, log_lik_intercept);
target += normal_lpdf(alpha | 0, 2);
}
super_model <- cmdstan_model("2021-bayes-factors.stan")
## Model executable is up to date!
But how do we get back to the value we are actually interested in, that is \(P(z = 1 | \mathbf{y})\) when there no longer is any \(z\)?
We can use the Bayes rule and since \(z\) and \(\alpha\) are a-prior independent, we can assume \(P(z = 1 | \alpha) = P(z = 1) = \frac{1}{2}\). This gives:
\[ P(z = 1 | \mathbf{y}, \alpha) =\\ = \frac{P(z = 1 | \alpha) \times p(\mathbf{y} | z = 1, \alpha)}{P(z = 1 | \alpha) \times p(\mathbf{y} | z = 1, \alpha) + P(z = 2 | \alpha) \times p(\mathbf{y} | z = 2, \alpha)} = \\ =\frac{\frac{1}{2} p(\mathbf{y} | z = 1)}{\frac{1}{2} p(\mathbf{y} | z = 1) + \frac{1}{2} p(\mathbf{y} | z = 2, \alpha)} \]
So to get the desired \(P(z = 1 | \mathbf{y})\) I need to integrate out \(\alpha\), which I can approximate via posterior samples:
\[ P(z = 1 | \mathbf{y}) = \int P(z = 1 | \mathbf{y}, \alpha) \mathrm{d} \alpha \simeq \frac{1}{M} \sum_m P(z = 1 | \mathbf{y}, \alpha = \alpha_m) \]
So let us fit the model:
fit_super <- super_model$sample(
data = list(K = length(y), y = y), refresh = 0, iter_sampling = 10000)
## Running MCMC with 4 chains, at most 12 in parallel...
##
## Chain 1 finished in 0.3 seconds.
## Chain 2 finished in 0.4 seconds.
## Chain 3 finished in 0.3 seconds.
## Chain 4 finished in 0.3 seconds.
##
## All 4 chains finished successfully.
## Mean chain execution time: 0.4 seconds.
## Total execution time: 0.5 seconds.
fit_super$summary() %>% table_format()
| variable | mean | median | sd | mad | q5 | q95 | rhat | ess_bulk | ess_tail |
|---|---|---|---|---|---|---|---|---|---|
| lp__ | -6.5500559 | -6.3973750 | 0.8351213 | 0.777557 | -8.143562 | -5.702910 | 1.000295 | 11109.72 | 11929.15 |
| alpha | 0.0162464 | 0.0981009 | 1.7726911 | 1.438439 | -3.067508 | 2.972789 | 1.000240 | 10600.70 | 11100.30 |
| log_lik_null | -4.1307500 | -4.1307500 | 0.0000000 | 0.000000 | -4.130750 | -4.130750 | NA | NA | NA |
| log_lik_intercept | -10.4013700 | -5.9333600 | 10.4287565 | 2.733907 | -31.625405 | -4.040298 | 1.000229 | 11078.21 | 11884.79 |
No warnings, rhat
and ess
look good. Now, let’s extract the partial likelihoods
and combine them into the BMA weight:
super_samples <-posterior::as_draws_matrix(fit_super$draws())
rel_p_null <- exp(super_samples[,"log_lik_null"])
rel_p_intercept <- exp(super_samples[,"log_lik_intercept"])
prob_null_stan <- mean(rel_p_null / (rel_p_null + rel_p_intercept))
bf_stan <- prob_null_stan / (1 - prob_null_stan)
res_stan <- data.frame(
method = "super_stan", bf = bf_stan, prob_null = prob_null_stan)
rbind(res_stan, res_jags, res_prior, res_brms) %>% table_format()
| method | bf | prob_null |
|---|---|---|
| super_stan | 3.711144 | 0.7877373 |
| super_jags | 3.950495 | 0.7980000 |
| prior | 3.748338 | 0.7894000 |
| brms | 3.725066 | 0.7883628 |
By marginalizing, we are not only having a model with fewer parameters (and hence simpler to sample), we are also able to better resolve tails: if I have 1000 samples of \(z\), I cannot reliably estimate if \(P(z = 1) < 10^{-3}\) - I will just see that none (or almost none) samples are \(1\). After marginalizing, each sample gives me directly a sample of \(P(z = 1)\), so I can get reasonable precision even if \(P(z = 1)\) is very close to \(0\) or \(1\).
Viewing Bayes factors as derived from posterior probabilities of an index over candidate models (\(z\) in our case), puts a different angle on the distinction between \(\mathcal{M}\)-closed scenarios (the true model is among the models we compare) and \(\mathcal{M}\)-open / \(\mathcal{M}\)-complete where this is not the case.
If we treat the model selection as fitting the super model with the candidates as submodels, being in an \(\mathcal{M}\)-open scenario simply means that the super model is misspecified. Unfortunately, as discussed above, Bayes factors can be very sensitive to both prior and likelihood specification, where other approaches, e.g. approximate leave-one-out cross validation with loo
is usually less sensitive to priors and less often overconfident in face of misspecifaction (see e.g. Using Stacking to Average Bayesian Predictive Distributions by Yao et al. for more discussion).
But we have many good ways to detect model misspecification, including prior and posterior predictive checks and other steps outlined in the Bayesian workflow preprint. So it would be interesting to test whether there is something to be gained by running prior and posterior predictive checks (or other diagnostics), not only for the component models, but for the “supermodel” implied by the selection scheme. But I’ll that to people who actually want to use Bayes factors :-D.
I’ll further note that I tried to implemented a supermodel with two realistic models and it appears that such supermodels can be challenging to fit (my impression is that the problem is primarily in initialization, but I didn’t investigate thoroughly).
Above, we computed the Bayes factors only for one dataset, so you might not be convinced that the agreement holds for any dataset. So here we’ll encapsulate the code in a few functions and evaluate a bit larger sample.
bf_brms <- function(y) {
fit_new <- update(fit_brms, newdata = data.frame(y = y), refresh = 0)
hyp_res <- hypothesis(fit_new, "Intercept = 0")
bf_brms <- hyp_res$hypothesis$Evid.Ratio
prob_null_brms <- hyp_res$hypothesis$Post.Prob
data.frame(method = "brms", bf = bf_brms, prob_null = prob_null_brms)
}
bf_prior <- function(y) {
prior_log_evidence_null <- sum(dnorm(y, mean = 0, sd = 1, log = TRUE))
prior_Sigma <- diag(length(y)) + matrix(4, nrow = length(y), ncol = length(y))
prior_log_evidence_intercept <-
mvtnorm::dmvnorm(y, mean = rep(0, length(y)), sigma = prior_Sigma, log = TRUE)
bf_prior <- exp(prior_log_evidence_null - prior_log_evidence_intercept)
prob_null_prior <- bf_prior / (bf_prior + 1)
data.frame(method = "prior", bf = bf_prior, prob_null = prob_null_prior)
}
bf_super_stan <- function(y) {
fit_super <- super_model$sample(data = list(K = length(y), y = y), refresh = 0,
iter_sampling = 10000)
super_samples <-posterior::as_draws_matrix(fit_super$draws())
rel_p_null <- exp(super_samples[,"log_lik_null"])
rel_p_intercept <- exp(super_samples[,"log_lik_intercept"])
p_null <- mean(rel_p_null / (rel_p_null + rel_p_intercept))
bf <- p_null / (1 - p_null) # The Bayes factor
data.frame(method = "super_Stan", bf = bf, prob_null = p_null)
}
bf_super_jags <- function(y) {
data_list <- list(
y = y)
params_to_monitor <- c("z_0", "alpha")
# Running the model
model <- jags.model( textConnection(jags_model_string), data_list,
n.chains = 4, n.adapt= 1000)
update(model, 1000); # Burning 1000 samples to the MCMC gods...
mcmc_samples <- coda.samples(model, params_to_monitor, n.iter=10000, thin = 10)
z_array <- cbind(mcmc_samples[[1]][, "z_0"], mcmc_samples[[2]][, "z_0"],
mcmc_samples[[3]][, "z_0"], mcmc_samples[[4]][, "z_0"])
prob_null_jags <- mean(z_array == 0)
prob_null_jags
bf_jags <- prob_null_jags / (1 - prob_null_jags)
bf_jags
data.frame(method = "super_jags", bf = bf_jags, prob_null = prob_null_jags)
}
comparisons_file <- paste0(cache_dir, "/comparison.rds")
if(!file.exists(comparisons_file)) {
set.seed(3384528)
res_list <- list()
for(i in 1:50) {
use_null <- (i %% 2) == 0
N <- 2 + rnbinom(1, mu = 10, size = 1)
if(use_null) {
mu <- 0
} else {
mu <- rnorm(1, 0, 2)
}
y <- rnorm(10, mu, sd = 1)
res_list[[i]] <- rbind(bf_prior(y),
bf_brms(y),
bf_super_jags(y),
bf_super_stan(y))
res_list[[i]]$id = i
res_list[[i]]$null_true = use_null
res_list[[i]]$N = N
}
res <- do.call(rbind, res_list)
saveRDS(res, comparisons_file)
} else {
res <- readRDS(comparisons_file)
}
We note that some Bayes factors - exclusively those computed by the unmarginalized JAGS model are 0. This is unsurprising, as the 10000-iteration JAGS model loses ability to capture very low null probabilities and hence low Bayes factors - looking at the analytically computed Bayes factors of those problematic results they are invariably very low.
# Contrast the BFs with the "prior" (analytically computed)
comparisons_to_plot <- res %>% group_by(id) %>%
mutate(bf_prior = bf[method == "prior"],
prob_null_prior = bf[method == "prior"]) %>%
ungroup() %>%
filter(method != "prior")
zero_bf <- comparisons_to_plot %>% filter(bf == 0)
if(!identical(unique(zero_bf$method), "super_jags")){
stop("Bad assumption")
}
nrow(zero_bf)
## [1] 11
zero_bf$bf_prior
## [1] 1.242613e-37 3.423453e-23 3.619076e-09 1.497207e-21 4.917385e-10
## [6] 2.431973e-14 2.176901e-20 2.514081e-53 1.366711e-13 8.921497e-07
## [11] 1.321580e-05
We’ll exclude those invalid Bayes factors from further consideration.
comparisons_to_plot <- comparisons_to_plot %>% filter(bf > 0)
We can now plot the results of the various Monte carlo methods against the analytical results:
base_comparisons_plot <- function(comparisons, x, y, trans, breaks = waiver()) {
comparisons %>%
sample_frac() %>% #random reorder
ggplot(aes(x = {{x}}, y = {{y}}, color = method, shape = method)) +
geom_abline(slope = 1, intercept = 0, color = "black") +
geom_point(size = 3, alpha = 0.8) +
guides(color = guide_legend(override.aes = list(alpha = 1))) +
scale_x_continuous(trans = trans, breaks = breaks) +
scale_y_continuous(trans = trans, breaks = breaks)
}
base_comparisons_plot(comparisons_to_plot, bf_prior, bf, trans = "log",
breaks = c(1e-45, 1e-30,1e-15, 1))
We immediately see that only the marginalized Stan model keeps high agreement for the very low Bayes factors (yay marginalization!).
We can also zoom in on the upper-right area, where we see pretty good agreement between all methods.
base_comparisons_plot(comparisons_to_plot %>% filter(bf_prior > 1e-3),
bf_prior, bf, trans = "log",
breaks = c(1e-3, 1e-2,1e-1, 1, 10))
Following the method outline by Schad et al. we also check the calibration of our Bayes factors. Since the model has analytical solution, our simulations are going to be much cheaper than in actual practice and we can do a lot of them.
N_calibration <- 20 # How many values in a dataset
set.seed(5487654)
res_cal_list <- list()
for(i in 1:5000) {
use_null <- (i %% 2) == 0
if(use_null) {
mu <- 0
} else {
mu <- rnorm(1, 0, 2)
}
y <- rnorm(N_calibration, mu, sd = 1)
res_cal_list[[i]] <- bf_prior(y)
res_cal_list[[i]]$null_true = use_null
}
calibration <- do.call(rbind, res_cal_list)
As a quick heuristic, reflecting some common usage, we will interpret BF > 3 as weak evidence and BF > 10 as strong evidence. If we do this, this is how our results look like based on whether the null is actually true:
calibration %>% group_by(null_true) %>%
summarise(strong_null = mean(bf >= 10),
weak_null = mean(bf >= 3 & bf < 10),
no_evidence = mean(bf < 3 & bf > 1/3),
weak_intercept = mean(bf <= 1/3 & bf > 0.01),
strong_intercept = mean(bf <= 0.01), .groups = "drop") %>%
table_format()
| null_true | strong_null | weak_null | no_evidence | weak_intercept | strong_intercept |
|---|---|---|---|---|---|
| FALSE | 0 | 0.1364 | 0.0852 | 0.0924 | 0.686 |
| TRUE | 0 | 0.8572 | 0.1328 | 0.0100 | 0.000 |
We see that in the case of observing 20 values, this simple heuristic makes a potentially non-intuitive trade-off where low rates of wrongly claiming support for the intercept model, the maternal uncle of despair, are balanced by low rates of correctly finding strong support for the null model and by somewhat large rate of finding weak evidence in favor of the null model, even when this model was not used to simulate data.
This is just to illustrate the point made by Schad et al. that explicit calibration and decision analysis should be done in the context of a given experimental design and utility/cost of actual decisions. But wan can be safe in the knowledge that the poor null model is unlikely to suffer unjust rejections in this case.
Bayes factors are not very intuitive, but I hope that understanding that the same number can be understood as either being a ratio of prior predictive densities or from a larger model taking the candidate models as components could help improve the intuition. In line with the (better, more thoroughly done) results of Schad et al. we also observe that computation of Bayes factors cannot be taken for granted and that simple heuristics to interpret Bayes factors may have non-obvious implications.
Now go read Workflow Techniques for the Robust Use of Bayes Factors!


{loader} {config}
This page creates a timer loop that will call setTimeout 30 times in order to force ST to be harvested. It also generates an error, which should be sent with the ST.


# extends 'base.html' # import 'macro/utils.html' as utils # import 'auth/macro/providers.html' as providers # block head {{utils.prefetch_link(next_url)}} # endblock # block content


Home Page
menu
;
Order Delivery
Menu
Royale with Cheese
$8.99
Add to Order
// parent
Swine of the Fire
$14.99
Add to Order
Grassfed Pizza Pie
$11.99
Add to Order
Ice Cream Sammich
$7.99
Add to Order
Order
Subtotal
$0.00
Tax
$0.00
Total
$0.00
account_circle
Name
phone
Telephone
home
Address
PLACE ORDER


The header now is cooler!
The header idea is cool, isn't it?
Below the used code for this example
$(document).ready(function() { $('header').backgroundor('lgradient',{intervaltime: 80, colors: ['#3b679e','#137FD8','#7db9e8']}); });
Go back to index to check the rest of the examples


|
Test Case
|
INIT-0010 |
|
Title
|
Initialization with no existing SQLite database |
|
Objective
|
This test case is intended to verify the following implied or specified requirements:
- When the app is started by selecting from the Android app selection menu, the app shall do the following:
- If the portfolio database does not exist, the app shall create the database and then display a blanked main menu.
- rtnv shall initialize and create an empty portfolio if none exists (first time run on the device).
- rtnv shall use SQLite to create a persistent store of the portfolio on the target device.
The objective of this test case is to verify the above requirements. This test will be executed the first time the app is loaded onto the Android device. At that point, no portfolio will exist so the image of it, the SQLite database, will be created and will contain no stock entries. |
|
Setup
|
- Android device with version 4.2 or greater is attached to the Android development system. There is no copy of rtnv installed on the device.
|
|
Actions
|
- Compile and load rtnv onto the target Android device.
- Verify the compile completes with no errors.
- Verify the installation completes with no errors.
- Verify that a screen is displayed that has a text field for the ticker symbol, a text field for the number of shares, and a text field for the value of each share.
- Verify that there are four buttons: Enter, Delete, Next, and Calculate Net Value.
- Verify that no runtime errors are splashed to the screen.
|
|
Expected
|
With this being the first time the app has run on the device, the database should be created and the main menu should be void of valid stock entries. |
|
Results
|
PASSED |
|
Cleanup
|
|
|
Requirements
|
RTNV-PR-INIT-010, RTNV-PR-INIT-010.001, RTNV-PROV-010, RTNV-EXT-IF-070 |


Overview
Classes: SecureServerSocket, SecureServerSocketImpl, SecureSocketImpl, SecureStreamSocket, SecureStreamSocketImpl
Classes
class SecureServerSocket
A server socket for secure SSL connections.
class SecureServerSocketImpl
The SocketImpl class for SecureServerSocket.
class SecureSocketImpl
The SocketImpl for SecureStreamSocket.
class SecureStreamSocket
A subclass of StreamSocket for secure SSL sockets.


| I l@ve RuBoard |
Bitsets model fixed-sized arrays of bits or Boolean values. They are useful to manage sets of flags, where variables may represent any combination of flags. C and old C++ programs usually use type long for arrays of bits and manipulate the bits with the bit operators, such as &, |, and ~. The class bitset has the advantage that bitsets may contain any number of bits, and additional operations are provided. For example, you can assign single bits, and read and write bitsets as a sequence of zeros and ones.
Note that you can't change the number of bits in a bitset. The number of bits is the template parameter. If you need a container for a variable number of bits or Boolean values, you can use the class vector<bool> (described in Section 6.2.6).
The class bitset is defined in the header file <bitset>:
#include <bitset>
In <bitset>, the class bitset is defined as a template class with the number of bits as the template parameter:
namespace std { template <size_t Bits> class bitset; }
In this case the template parameter is not a type but an unsigned integral value (see page 10 for details about this language feature).
Templates with different template arguments are different types. You can compare and combine bitsets only with the same number of bits.
The first example of using bitsets demonstrates how to use bitsets to manage a set of flags. Each flag has a value that is defined by an enumeration type. The value of the enumeration type is used as the position of the bit in the bitset. In particular, the bits represent colors. Thus, each enumeration value defines one color. By using a bitset, you can manage variables that might contain any combination of colors:
// cont/bitsetl.cpp #include <bitset> #include <iostream> using namespace std; int main() { /* enumeration type for the bits * - each bit represents a color */ enum Color { red, yellow, green, blue, white, black, ..., numColors }; // create bitsetfor all bits/colors bitset<numColors> usedColors; // set bits for two colors usedColors.set(red); usedColors.set(blue); // print some bitset data cout << "bitfield of used colors: " << usedColors << endl; cout << "number of used colors: " << usedColors.count() << endl; cout << "bitfield of unused colors: " << ~usedColors << endl; // if any color is used if (usedColors.any()) { // loop over all colors for (int c = 0; c < numColors; ++c) { // if the actual color is used if (usedColors[(Color)c]) { ... } } } }
A useful feature of bitsets is the ability to convert integral values into a sequence of bits and vice versa. This is done simply by creating a temporary bitset:
// cont/bitset2.cpp #include <bitset> #include <iostream> #include <string> #include <limits> using namespace std; int main() { /* print some numbers in binary representation */ cout << "267 as binary short: " << bitset<numeric_limits<unsigned short>::digits>(267) << endl; cout << "267 as binary long: " << bitset<numeric_limits<unsigned long>::digits>(267) << endl; cout << "10,000,000 with 24 bits: " << bitset<24>(1e7) << endl; /* transform binary representation into integral number */ cout << "\"1000101011\" as number: " << bitset<100>(string("1000101011")).to_ulong() << endl; }
Depending on the number of bits for short and long, the program might produce the following output:
267 as binary short:<PHONE_NUMBER>001011 267 as binary long:<PHONE_NUMBER>0000000000000100001011 10,000,000 with 24 bits:<PHONE_NUMBER>01011010000000 "1000101011" as number: 555
In this example,
bitset<numeric_limits<unsigned short>::digits>(267)
converts 267 into a bitset with the number of bits of type unsigned short (see Section 4.3, for a discussion of numeric limits). The output operator for bitset prints the bits as a sequence of characters 0 and 1.
Similarly,
bitset<100>(string("1000101011"))
converts a sequence of binary characters into a bitset, for which to_ulong() yields the integral value. Note that the number of bits in the bitset should be smaller than sizeof (unsigned long). This is because you get an exception when the value of the bitset can't be represented as unsigned long.[7]
[7] Note that you have to convert the initial value to type string explicitly. This is probably a mistake in the standard because it was possible to use
bitset<100>("1000101011")
in earlier versions of the standard. By accident this implicit type conversion was ruled out when this constructor was templified for different string types. There is a proposed resolution to fix this problem.
The bitset class provides the following operations.
For bitsets, some special constructors are defined. However, there is no special copy constructor, assignment operator, and destructor defined. Thus, bitsets are assigned and copied with the default operations that copy bitwise.
bitset<bits>::bitset ()
The default constructor.
Creates a bitset with all bits initialized with zero.
For example:
bitset<50> flags; // flags: 0000...000000 // thus, 50 unset bits
bitset<bits>::bitset (unsigned long value)
Creates a bitset that is initialized according to the bits of the integral value value.
If the number of bits of value is too small, the leading bit positions are initialized to zero.
For example:
bitset<50> flags (7); // flags: 0000...000111
explicit bitset<bits>::bitset (const string& str)
bitset<bits>::bitset (const string& str, string::size_type str_idx)
bitset<bits>::bitset (const string& str, string::size_type str_idx, string::size_type str_num)
All forms create a bitset that is initialized by the string str or a substring of str.
The string or substring may contain only the characters '0' and '1'.
str_idx is the index of the first character of str that is used for initialization.
If str_num is missing, all characters from str_idx to the end of str are used.
If the string or substring has fewer characters than necessary, the leading bit positions are initialized to zero.
If the string or substring has more characters than necessary, the remaining characters are ignored.
Throw out_of_range if str_idx > str.size().
Throw invalid_argument if one of the characters is neither '0' nor '1'.
Note that this constructor is a member template (see page 11). For this reason no implicit type conversion from const char* to string for the first parameter is provided.[8]
[8] This is probably a mistake in the standard because it was possible to use
bitset<50> flags("l0l0l0l")
in earlier versions of the standard. By accident this implicit type conversion was ruled out when this constructor was templified for different string types. There is a proposed resolution to fix this problem.
For example:
bitset<50> flags(string("1010101")); // flags: 0000...0001010101 bitset<50> flags(string("1111000"),2,3); // flags: 0000...0000000110
size_t bitset<bits>::size () const
Returns the number of bits (thus, bits)
size_t bitset<bits>::count () const
Returns the number of set bits (bits with value 1).
bool bitset<bits>::any () const
Returns whether any bit is set.
bool bitset<bits>::none () const
Returns whether no bit is set.
bool bitset<bits>::test (size_t idx) const
Returns whether the bit at position idx is set.
Throws out_of_range if idx > size().
bool bitset<bits>::operator == (const bitset<bits>& bits) const
Returns whether all bits of *this and bits have the same value.
bool bitset<bits>::operator != (const bitset<bits>& bits) const
Returns whether any bits of *this and bits have a different value.
bitset<bits>& bitset<bits>::set()
Sets all bits to true.
Returns the modified bitset.
bitset<bits>& bitset<bits>::set (size_t idx)
Sets the bit at position idx to true.
Returns the modified bitset.
Throws out_of_range if idx > size().
bitset<bits>& bitset<bits>::set (size_t idx, int value)
Sets the bit at position idx according to value.
Returns the modified bitset.
value is processed as a Boolean value. If value is equal to 0, the bit is set to false. Any other value sets the bit to true.
Throws out_of _range if idx > size().
bitset<bits>& bitset<bits>::reset()
Resets all bits to false (assigns 0 to all bits).
Returns the modified bitset.
bitset<bits>& bitset<bits>::reset (size_t idx)
Resets the bit at position idx to false.
Returns the modified bitset.
Throws out_of_range if idx > size().
bitset<bits>& bitset<bits>::flip ()
Toggles all bits (sets unset bits and vice versa).
Returns the modified bitset.
bitset<bits>& bitset<bits>::flip (size_t idx)
Toggles the bit at position idx.
Returns the modified bitset.
Throws out_of_range if idx > size().
bitset<bits>& bitset<bits>::operator \'88= (const bitset<bits>& bits)
The bitwise exclusive-or operator.
Toggles the value of all bits that are set in bits and leaves all other bits unchanged.
Returns the modified bitset.
bitset<bits>& bitset<bits>::operator | = (const bitset<bits>& bits)
The bitwise or operator.
Sets all bits that are set in bits and leaves all other bits unchanged.
Returns the modified bitset.
bitset<bits>& bitset<bits>::operator &= (const bitset<bits>& bits)
The bitwise and operator.
Resets all bits that are not set in bits and leaves all other bits unchanged.
Returns the modified bitset.
bitset<bits>& bitset<bits>::operator <<= (size_t num)
Shifts all bits by num positions to the left.
Returns the modified bitset.
The first num bits are set to false.
bitset<bits>& bitset<bits>::operator >>= (size_t num)
Shifts all bits by num positions to the right.
Returns the modified bitset.
The last num bits are set to false.
bitset<bits>::reference bitset<bits>::operator [ ] (size_t idx)
bool bitset<bits>::operator [ ] (size_t idx) const
Both forms return the bit at position idx
The first form for nonconstant bitsets uses a proxy type to enable the use of the return value as a modifiable value (lvalue). See the next paragraphs for details.
The caller must ensure that idx is a valid index; otherwise, the behavior is undefined.
Operator [ ] returns a special temporary object of type bitset<>::reference when it is called for nonconstant bitsets. That object is used as a proxy[9] that allows certain modifications with the bit that is accessed by operator []. In particular, for references the following five operations are provided:
[9] A proxy allows you to keep control where usually no control is provided. This is often used to get more security. In this case, it maintains control to allow certain operations, although the return value in principle behaves as bool.
referencefe& operator= (bool)
Sets the bit according to the passed value.
reference& operator= (const reference&)
Sets the bit according to another reference.
reference& flip ()
Toggles the value of the bit.
operator bool () const
Converts the value into a Boolean value (automatically).
bool operator~ () const
Returns the complement (toggled value) of the bit.
For example, you can write the following statements:
bitset<50> flags; ... flags [42] = true; // set bit 42 flags [13] = flags[42]; // assign value of bit 42 to bit 13 flags [42].flip(); // toggle value of bit 42 if (flags [13]) { // if bit 13 is set, flags [10] = ~flags [42]; // then assign complement of bit 42 to bit 10 }
bitset<bits> bitset<bits>::operator ~ () const
Returns a new bitset that has all bits toggled with respect to *this.
bitset<bits> bitset<bits>::operator << (size_t num) const
Returns a new bitset that has all bits shifted to the left by num position.
bitset<bits> bitset<bits>::operator >> (size_t num) const
Returns a new bitset that has all bits shifted to the right by num position.
bitset<bits> operator & (const bitset<bits>& bits1, const bitset<bits>& bits2)
Returns the bitwise computing of operator and of bits1 and bits2.
Returns a new bitset that has only those bits set in bits1 and in bits2.
bitset<bits> operator | (const bitset<bits>& bits1, const bitset<bits>& bits2)
Returns the bitwise computing of operator or of bits1 and bits2.
Returns a new bitset that has only those bits set in bits1 or in bits2.
bitset<bits> operator^ (const bitset<bits>& bits1, const bitset<bits>& bits2)
Returns the bitwise computing of operator exclusive-or of bits1 and bits2.
Returns a new bitset that has only those bits set in bits1 and not set in bits2 or vice versa.
unsigned long bitset<bits>::to_ulong () const
Returns the integral value that the bits of the bitset represent.
Throws overflow_error if the integral value can't be represented by type unsigned long.
string bitset<bits>::to_string () const
Returns a string that contains the value of the bitset as a binary representation written with characters '0' for unset bits and '1' for set bits.
The order of the characters is equivalent to the order of the bits with descending index.
This function is a template function that is parameterized only by the return type. According to the language rules, you must write the following:
bitset b; ... b.template to_string<char,char_traits<char>,allocator<char> >()
istream& operator>> (istream& strm, bitset<bits>& bits)
Reads into bits a bitset as a character sequence of characters '0' and '1'.
Reads until any one of the following happens:
At most, bits characters are read.
End-of-file occurs in strm.
The next character is neither '0' nor '1'.
If the number of bits read is less than the number of bits in the bitset, the bitset is filled with leading zeros.
If this operator can't read any character, it sets ios::failbit in strm, which might throw the corresponding exception (see Section 13.4.4,).
ostream& operator << (ostream& strm, const bitset<bits>& bits)
Writes bits converted into a string that contains the binary representation (thus, as a sequence of '0' and '1').
See page 462 for an example.
| I l@ve RuBoard |


I have only been programming for about a year now but have found a love for it. I have experience with the python-django, but found my space when introduced to Reactjs.
In addition to web development, I enjoy taking data, analyzing it, and presenting it in such a way that others can make sense of it. I have used tools such as Tableau and Domo in order to build unique data visualizations that solve the needs of companies.


HMSScan Demo
Permissions
Check Permissions
Request Permissions
Default View Mode
Custom View Mode
Multi processor Syn Mode
Multi Processor Asyn Mode
Bitmap Mode
Select image for image scan
Select Image
Asyn Mode with Image
Syn Mode with Image
Decode with Bitmap
Generate Barcode


This is the Machine Learning web app used for estimating the health disease.
Diabetes is the condition in which the body does not properly process food for use as energy. Most of the food we eat is turned into glucose, or sugar, for our bodies to use for energy. The pancreas, an organ that lies near the stomach, makes a hormone called insulin to help glucose get into the cells of our bodies.
One of the most common complications of heart disease, heart failure occurs when your heart can't pump enough blood to meet your body's needs. Unhealthy lifestyle habits, such as a poor diet, lack of exercise, being overweight and smoking, can lead to atherosclerosis.
When your kidneys are damaged, waste products and fluid can build up in your body. That can cause swelling in your ankles, nausea, weakness, poor sleep, and shortness of breath. Without treatment, the damage can get worse and your kidneys may eventually stop working. That's serious, and it can be life-threatening.
The liver is essential for digesting food and ridding your body of toxic substances. Liver disease can be inherited (genetic). Liver problems can also be caused by a variety of factors that damage the liver, such as viruses, alcohol use and obesity. Alcohol abuse and liver disease: Alcohol abuse is the most common cause of liver disease. Alcohol is directly toxic to liver cells and can cause liver inflammation, referred to as alcoholic hepatitis. In chronic alcohol abuse, fat accumulation occurs in liver cells affecting their ability to function.
Breast cancer is caused when the DNA in breast cells mutate or change, disabling specific functions that control cell growth and division. In many cases, these mutated cells die or are attacked by the immune system. But some cells escape the immune system and grow unchecked, forming a tumor in the breast.
Causes of strokes include ischemia (loss of blood supply) or hemorrhage (bleeding) in the brain. People at risk for stroke include those who have high blood pressure, high cholesterol, diabetes, and those who smoke. People with heart rhythm disturbances, especially atrial fibrillation are also at risk.
A machine learning web app created using flask and deployed on heroku platform. Advantages of AI in Healthcare i. Improved accessibility ii. Increased speed and reduced costs iii. Enhanced human abilities iv. Removing some amount of dependencies on the doctors v. To help out the poor and helpless people with the normal medical checkup Technology Used Python, Machine Learning, Flask, HTML, CSS, Pycharm Feedback If you have any feedback, please reach out to me at LinkedIn Thank you!