Solidity

Loading
loading...

Solidity

November 7, 2023
mike@standardsmichigan.com
, , ,
No Comments

Solidity is a high-level, statically-typed programming language used for developing smart contracts on the Ethereum blockchain. Smart contracts are self-executing contracts with the terms of the agreement between buyer and seller written directly into lines of code. Solidity was specifically designed for the Ethereum platform, and it is the most widely used language for creating Ethereum-based smart contracts.

The code below shows how delegated voting can be done so that vote counting is automatic and completely transparent at the same time.

Photograph by Carol M. Highsmith. Library of Congress,

pragma solidity ^0.7.0;

/// @title Voting with delegation.
contract Ballot {
    // This declares a new complex type which will
    // be used for variables later.
    // It will represent a single voter.
    struct Voter {
        uint weight; // weight is accumulated by delegation
        bool voted;  // if true, that person already voted
        address delegate; // person delegated to
        uint vote;   // index of the voted proposal
    }

    // This is a type for a single proposal.
    struct Proposal {
        bytes32 name;   // short name (up to 32 bytes)
        uint voteCount; // number of accumulated votes
    }

    address public chairperson;

    // This declares a state variable that
    // stores a `Voter` struct for each possible address.
    mapping(address => Voter) public voters;

    // A dynamically-sized array of `Proposal` structs.
    Proposal[] public proposals;

    /// Create a new ballot to choose one of `proposalNames`.
    constructor(bytes32[] memory proposalNames) {
        chairperson = msg.sender;
        voters[chairperson].weight = 1;

        // For each of the provided proposal names,
        // create a new proposal object and add it
        // to the end of the array.
        for (uint i = 0; i < proposalNames.length; i++) {
            // `Proposal({...})` creates a temporary
            // Proposal object and `proposals.push(...)`
            // appends it to the end of `proposals`.
            proposals.push(Proposal({
                name: proposalNames[i],
                voteCount: 0
            }));
        }
    }

    // Give `voter` the right to vote on this ballot.
    // May only be called by `chairperson`.
    function giveRightToVote(address voter) public {
        // If the first argument of `require` evaluates
        // to `false`, execution terminates and all
        // changes to the state and to Ether balances
        // are reverted.
        // This used to consume all gas in old EVM versions, but
        // not anymore.
        // It is often a good idea to use `require` to check if
        // functions are called correctly.
        // As a second argument, you can also provide an
        // explanation about what went wrong.
        require(
            msg.sender == chairperson,
            "Only chairperson can give right to vote."
        );
        require(
            !voters[voter].voted,
            "The voter already voted."
        );
        require(voters[voter].weight == 0);
        voters[voter].weight = 1;
    }

    /// Delegate your vote to the voter `to`.
    function delegate(address to) public {
        // assigns reference
        Voter storage sender = voters[msg.sender];
        require(!sender.voted, "You already voted.");

        require(to != msg.sender, "Self-delegation is disallowed.");

        // Forward the delegation as long as
        // `to` also delegated.
        // In general, such loops are very dangerous,
        // because if they run too long, they might
        // need more gas than is available in a block.
        // In this case, the delegation will not be executed,
        // but in other situations, such loops might
        // cause a contract to get "stuck" completely.
        while (voters[to].delegate != address(0)) {
            to = voters[to].delegate;

            // We found a loop in the delegation, not allowed.
            require(to != msg.sender, "Found loop in delegation.");
        }

        // Since `sender` is a reference, this
        // modifies `voters[msg.sender].voted`
        sender.voted = true;
        sender.delegate = to;
        Voter storage delegate_ = voters[to];
        if (delegate_.voted) {
            // If the delegate already voted,
            // directly add to the number of votes
            proposals[delegate_.vote].voteCount += sender.weight;
        } else {
            // If the delegate did not vote yet,
            // add to her weight.
            delegate_.weight += sender.weight;
        }
    }

    /// Give your vote (including votes delegated to you)
    /// to proposal `proposals[proposal].name`.
    function vote(uint proposal) public {
        Voter storage sender = voters[msg.sender];
        require(sender.weight != 0, "Has no right to vote");
        require(!sender.voted, "Already voted.");
        sender.voted = true;
        sender.vote = proposal;

        // If `proposal` is out of the range of the array,
        // this will throw automatically and revert all
        // changes.
        proposals[proposal].voteCount += sender.weight;
    }

    /// @dev Computes the winning proposal taking all
    /// previous votes into account.
    function winningProposal() public view
            returns (uint winningProposal_)
    {
        uint winningVoteCount = 0;
        for (uint p = 0; p < proposals.length; p++) {
            if (proposals[p].voteCount > winningVoteCount) {
                winningVoteCount = proposals[p].voteCount;
                winningProposal_ = p;
            }
        }
    }

    // Calls winningProposal() function to get the index
    // of the winner contained in the proposals array and then
    // returns the name of the winner
    function winnerName() public view
            returns (bytes32 winnerName_)
    {
        winnerName_ = proposals[winningProposal()].name;
    }
}

Homeland Power Security

November 7, 2023
mike@standardsmichigan.com
, ,
No Comments

“Electric Production and Direction” 1933 / William Karp / Smithsonian American Art Museum

We collaborate with the IEEE Education & Healthcare Facilities Committee in assisting the US Army Corps of Engineers in gathering power system data from education communities that will inform statistical solutions for enhancing power system reliability for the Homeland.

United States Army Corps Power Relability Enhancement Program Flyer No. 1

United States Army Corps Power Reliability Enhancement Program Flyer No. 2

We maintain status information about this project — and all projects that enhance the reliability of education community power reliability — on the standing agenda of our periodic Power, Risk and Security colloquia.   See our CALENDAR for the next online meeting; open to everyone

Issue: [19-156]

Category: Power, Data, Security

Colleagues: Mike Anthony, Robert G. Arno, Mark Bunal, Jim Harvey, Jerry Jimenez, Paul Kempf. Richard Robben

Education & Healthcare Facility Electrotechnology Committee

Can Voters Detect Malicious Manipulation of Ballot Marking Devices?

November 7, 2023
mike@standardsmichigan.com
,
No Comments

 

Can Voters Detect Malicious Manipulation of Ballot Marking Devices?

Matthew Bernhard, et. al

University of Michigan

 

Abstract:  Ballot marking devices (BMDs) allow voters to select candidates on a computer kiosk, which prints a paper ballot that the voter can review before inserting it into a scanner to be tabulated. Unlike paperless voting machines, BMDs provide voters an opportunity to verify an auditable physical record of their choices, and a growing number of U.S. jurisdictions are adopting them for all voters. However, the security of BMDs depends on how reliably voters notice and correct any adversarially induced errors on their printed ballots. In order to measure voters’ error detection abilities, we conducted a large study (N = 241) in a realistic polling place setting using real voting machines that we modified to introduce an error into each printout. Without intervention, only 40% of participants reviewed their printed ballots at all, and only 6.6% told a poll worker something was wrong. We also find that carefully designed interventions can improve verification performance. Verbally instructing voters to review the printouts and providing a written slate of candidates for whom to vote both significantly increased review and reporting rates-although the improvements may not be large enough to provide strong security in close elections, especially when BMDs are used by all voters. Based on these findings, we make several evidence-based recommendations to help better defend BMD-based elections.

 

IEEE provides this article for public use without charge.

Not-for-Profit Update

November 6, 2023
mike@standardsmichigan.com
,
No Comments

We track action in the catalog of this consortia standards developer because we continually seek ways to avoid spending a dollar to save a dime; characteristic of an industry that is a culture more than it is a business.

 

While not an ANSI accredited the FASB/GASB standards setting enterprise’s due process requirements (balance, open-ness, appeal, etc.)* are “ANSI-like” and widely referenced in education enterprise management best practice.  Recent action in its best practice bibliography is listed below

ACCOUNTING STANDARDS UPDATES ISSUED

For obvious reasons, we have an interest in its titles relevant to Not-For-Profit Entities

WHAT IS THE FASB NOT-FOR-PROFIT ENTITY TEAM

At present the non-profit titles are stable with the 2020 revision.  That does not mean there is not work than can be done.  Faculty and students may be interested in the FASG program linked below:

Academics in Standard Setting

Also, the “Accounting for Environmental Credit Programs”, last updated in January, may interest colleges and universities with energy and sustainability curricula.  You may track progress at the link below:

EXPOSURE DOCUMENTS OPEN FOR COMMENT

The Battle about Money

We encourage our colleagues to communicate directly with the FASB on any issue (Click here).   Other titles in the FASB/GASB best practice bibliography are a standing item on our Finance colloquia; open to everyone.  Use the login credentials at the upper right of our home page.

 

Issue: [15-190]

Category: Finance, Administration & Management, Facility Asset Management

Colleagues: Mike Anthony, Jack Janveja, Richard Robben


Workspace / FASB GASB

International Building Code | Electrical

November 6, 2023
mike@standardsmichigan.com

No Comments

Electrical building — World Columbian Exposition, Chicago, Illinois 1892

The International Code Council bibliography of electrical safety practice incorporates titles published by the National Fire Protection Association which reference electrical safety science titles published by the Institute of Electrical and Electronic Engineers.  The relevant section of the International Building Code is therefore relatively short:

2021 International Building Code: Chapter 27 Electrical

Note that Chapter 27 provides more guidance on managing the hazards created when electricity is absent*.  Since the National Electrical Code is informed by a fire safety building premise wiring culture; absence of electricity is not as great a hazard as when building wiring systems are energized.  (“So they say” — Mike Anthony, who thinks quite otherwise.)

2024/2025/2026 ICC CODE DEVELOPMENT SCHEDULE

Code change submittals for the Group A tranche of titles will be received until January 8, 2024.

Although we collaborate most closely with the IEEE Education & Healthcare Facilities Committee (four times monthly in Europe and the Americas) we e encourage our colleagues in education communities everywhere to participate directly in the ICC Code Development process.   CLICK HERE to set up an account.

It is enlightening — and a time saver — to unpack the transcripts of previous revisions of codes and standards to see what concepts were presented, what got discussed; what passed and what failed.  We provide links to a few previous posts that track recent action in the ICC suite relevant to electrotechnologies:

Electric Vehicle Charging

Entertainment Occupancies

K-TAG Matrix for Healthcare Facilities

International Energy Conservation Code

The ICC suite of consensus products are relevant to almost all of our work; everyday.   See our CALENDAR that reflects our Syllabus.  Today we deal with electrical safety concepts because technical committees are meeting from November to January to write the 2023 National Electrical Code.  CLICK HERE to follow the action in more detail.


* The original University of Michigan advocacy enterprise began pounding on National Electrical Code committees to install more power reliability concepts in the 2002 Edition with only modest success.  Standards Michigan has since collaborated with the IEEE Education & Healthcare Facilities Committee to drive “absence-of-power-as-a-hazard” into the National Electrical Code; the 2023 now open for public consultation.

 

Artificial Intelligence with Python 2020

November 5, 2023
mike@standardsmichigan.com
,
No Comments

This content is accessible to paid subscribers. To view it please enter your password below or send mike@standardsmichigan.com a request for subscription details.

Enhancing the Sustainability of Outdoor Floodlighting for Cultural Heritage Buildings

November 5, 2023
mike@standardsmichigan.com
,
No Comments

Enhancing the Sustainability of Outdoor Floodlighting for Cultural Heritage Buildings

Matej B. Kobav, et al

Faculty of Electrical engineering, University of Ljubljana Slovenia

Abstract: Improperly lit architectural heritage sites contribute to intrusive light, impacting the environment. To combat this, a methodology using specialized luminaires with silhouette-based aperture was implemented during the renovation of Slovenian churches. By precisely directing light and minimizing spillage, this approach significantly reduced intrusive light. Real-life example of the Church of St. Thomas exemplifies its success. Such sustainable strategies ensure the preservation of cultural heritage while minimizing environmental impact.

 

Illumination Art

Related:

Principles of Energy Saving in Buildings. A Survey

 

Illumination Art

November 5, 2023
mike@standardsmichigan.com
,
No Comments

“Starry Night Over the Rhône” 1888 Vincent van Gogh

 

I often think that the night is more alive

and more richly colored than the day.

– Vincent van Gogh

 

The International Commission on Illumination — is devoted to worldwide cooperation and the exchange of information on all matters relating to the science and art of light and lighting, colour and vision, photobiology and image technology.  The landing page for its standards setting enterprise is linked below:

International Standards

With strong technical, scientific and cultural foundations, the CIE is an independent, non-profit organization that serves member countries on a voluntary basis. Since its inception in 1913, the CIE has become a professional organization and has been accepted as representing the best authority on the subject and as such is recognized by ISO as an international standardization body.

Illumination technologies influence designs in architectural design, public safety and energy economics in all education communities.   We find CIE titles referenced in ISO and IEC standards.  Because ISO and IEC standards are incorporated by referenced in the best practice literature published by standards setting organizations in every nation with a private standards setting body (such as ANSI, BSI, DIN, etc.) the CIE titles are worthy of our attention.

We only have resources to track a few of them:

ISO/CIE 20086:2019(E) Light and Lighting — Energy Performance of Lighting in Buildings

ISO 30061:2007(E)/CIE S 020/E:2007 Emergency Lighting

CIE S 015/E:2005 Lighting of outdoor work places

ISO 8995-1:2002(E)/CIE S 008/E:2001 Lighting of Work Places – Part 1: Indoor

There are others that we may track in the fullness of time.  Getting illumination technology right is subtle art.  The energy to drive normal, steady-state illumination usually consumes 25 to 40 percent of building energy but application of the art — which includes control — can reduce that.

We maintain CIE titles on our periodic Energy, Global, Interiors and Illumination colloquia.  See our CALENDAR for the next online meeting; open to everyone.

Yorkshire Dales


LEARN MORE:

Workspace / Commission Internationale de l’Eclairage

Colloquy January

November 4, 2023
mike@standardsmichigan.com

No Comments

This content is accessible to paid subscribers. To view it please enter your password below or send mike@standardsmichigan.com a request for subscription details.

رياضة

November 3, 2023
mike@standardsmichigan.com
No Comments

Alysha Newman | University of Miami | World Athletic Championships

Today we review the literature informing the safety and sustainability agenda of sport enterprises in education communities; in the United States at least — one of the last, if not the last, meritocracies in academia at large.  School districts have hundreds of playgrounds, gymnasiums and playgrounds.  Athletic departments are very visible enterprises; particularly at large colleges and universities with varsity teams that have long been “farm clubs” for professional sport companies.

This facility class is far more complicated (technically) than classroom facilities; closer to research and healthcare delivery enterprises in risk aggregation when you consider how many people are involved as spectators.  This facility class resides proximate to the actuality of rehabilitated or additional sanitary facilities which we cover in our periodic Water 200 colloquia.

Throughout 2024 we will break down our coverage thus:

Winter Sport

Field sport

Court sport

Water sport

We will also explore best practice codes and standards for recreational activity:

Rock Climbing: In the sport of rock climbing, technical skills, grip strength, and body positioning are crucial for both indoor and outdoor climbing. Climbers must navigate a variety of challenging terrains and routes.

Fencing: Fencing requires quick thinking, precise footwork, and precise blade work. Fencers need to anticipate their opponent’s moves and respond with well-timed and accurate attacks and parries.

Quidditch:  Once a fictional sport; now widely played as “Quadball”.


Internal Revenue Service Non-Profit Tax Filing 990: National Collegiate Athletic Association

 

There are no fewer than 25 ANSI-accredited standards-setting organizations with a catalog of titles in this domain.  We expanded the detail to some of the titles to enlighten understanding the complexity of these spaces:

Acoustical Society of America

Reviews of Acoustical Patents

American Institute of Steel Construction

Structural Steel Cantilivers for Sport Facilities

American Iron and Steel Institute

American Society of Civil Engineers

Athletic Field Lighting Standards Committee

American Society of Mechanical Engineers

American Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc.

Standard 90.1-2019, Energy Standard for Buildings Except Low-Rise Residential Buildings

Annex G

Standard 189.1-2020, Standard for the Design of High-Performance Green Buildings

ASTM International (ANSI’s US TAG to ISO/TC 83)*

Committee F08 on Sports Equipment, Playing Surfaces, and Facilities

American Society of Safety Engineers

American Water Works Association

Swimming advisories for Microcystins and Cylindrospermopsin

Association for Challenge Course Technology

Association of Public-Safety Communications Officials-International

Audiovisual and Integrated Experience Association

"The idea is not to block every shot. The idea is to make your opponent believe that you might block every shot" - Bill Russell

Building Industry Consulting Service International

Building Performance Institute

IAPMO Group

2021 IAPMO Solar, Hydronics and Geothermal, Swimming Pool, Spa and Hot Tub Codes

Uniform Plumbing Code

Illumination Engineering Society

RP-6-20: Sports and Recreational Area Lighting

Institut für Sportbodentechnik

Criteria for the Development of Guidelines/Standards for Sports Surfaces

International Code Council

International Building Code

 § Section 302 Occupancy Classification and Use Designation

 § Section 303 Assembly Group A

 § Section 305 Educational Group E

International Energy Conservation Code

Class IV facilities consisting of elementary school and recreational facilities; and amateur league and high school facilities without provisions for spectators

 § 301 Climate Zones

§ C405 Electrical Power and Lighting Requirements

§ 405.3 Interior lighting power requirements

ICC 300-2017: Standard for Bleachers, Folding and Telescopic Seating, and Grandstands

International Plumbing Code

Institute of Electrical and Electronic Engineers

The application research of virtual reality technology in emergency evacuation simulation of sports stadium

Sports, Recreational Facilities & Equipment

National Center for Biotechnology Information

Comparison of Three Timing Systems: Reliability and Best Practice Recommendations in Timing Short-Duration Sprints

National Fire Protection Association

National Electrical Code

Article 518 Assembly Occupancies

Chapter 7 Special Conditions

Chapter 8 Communications Systems

National Operating Committee on Standards for Athletic Equipment

NSF International

Recreational Water / Pools / Spas

Synthetic Turf Council

….And so on.  We approach federal regulations during a separate colloquium.

Facilities of this type are among the most visible physical assets of any school district, college or university.

Our daily colloquia are open to everyone. Use the login credentials at the upper right of our home page.


*ASTM activity in this domain involves more product conformance and less facility integrated systems (our primary interest)

Readings / Sport, Culture & Society

* Eugen Rosenstock-Huessy (1888-1973) was a German-American philosopher, social thinker, and linguist. He was born in Berlin, Germany, and was raised in a Jewish family. Rosenstock-Huessy studied law, theology, and philosophy in Berlin, but his studies were interrupted by World War I. During the war, he served as a lieutenant in the German army and was taken prisoner by the Russian army.

After the war, Rosenstock-Huessy continued his studies and became a professor of law and sociology at the University of Breslau. He was forced to leave Germany in 1933 because of his opposition to the Nazi regime, and he emigrated to the United States. In the United States, Rosenstock-Huessy continued his academic work and became a professor of social philosophy at Dartmouth College in New Hampshire.

Rosenstock-Huessy’s work focused on the role of language in shaping human culture and social institutions. He believed that language was not just a means of communication but was also a way of creating and organizing social relations. His ideas had a significant influence on the development of linguistic phenomenology and hermeneutics.

Some of his notable works include “Out of Revolution: Autobiography of Western Man”, “Speech and Reality”, and “The Christian Future, or the Modern Mind Outrun”.


Related:

Watersport

Layout mode
Predefined Skins
Custom Colors
Choose your skin color
Patterns Background
Images Background
Skip to content