c++ – 10 Kinds of People

Follow up to this question: 10 Kinds of People Open Kattis Problem Time Limit Exceeded C++

Solves the puzzle linked in that question.

I use Dijkstra algorithm to find items.
The only twist is that each time I do a search I save the boundary list of the search in a Zone. On a subsequent search if my current “Zone” bumps into an existing Zone I merge the boundary lists and make the old zone point at the current zone.

The searched squares are stored directly on the map 0 or 1 mean original value while any value >= 100 means a zone number (subtract 100 to get the zone). You can then use this value in the zoneMap (if zones clide this keeps the mapping upto date) to get the zone it belongs to.

I tried A* but for a problem space this small it doubles the time as you need to keep an ordered list to know which item to search for next. You can see the remininest of the A* stuff in the Zone class as commented out parts to keep the boundary list sorted.

#include <utility>
#include <vector>
#include <queue>
#include <map>
#include <iostream>
#include <functional>

struct Point: public std::pair<int, int>
{
    friend std::istream& operator>>(std::istream& str, Point& dst)
    {
        return str >> dst.first >> dst.second;
    }
    friend std::ostream& operator<<(std::ostream& str, Point const& src)
    {
        return str << "(" << src.first << "," << src.second << ") ";
    }
};

class Zone
{
    Point                       dst;
    char                        type;
    int                         id;
    std::vector<Point>          boundry;
    int distsq(Point const& p) const
    {
        int x = std::abs(p.first - dst.first);
        int y = std::abs(p.second - dst.second);
        return x * x + y * y;
    }
    bool order(Point const& lhs, Point const& rhs) const
    {
        return distsq(lhs) > distsq(rhs);
    }

    public:
        Zone(char type, int id, Point dst)
            : type(type)
            , id(id)
            , dst(dst)
        {}
        char getType() const {return type;}
        int  getId()   const {return id;}
        void updateDestination(Point const& d)
        {
            using namespace std::placeholders;
            dst = d;
            //std::make_heap(std::begin(boundry), std::end(boundry), std::bind(&Zone::order, this, _1, _2));
        }
        bool empty() const          {return boundry.empty();}
        void push(Point const& p)
        {
            using namespace std::placeholders;
            boundry.emplace_back(p);
            //std::push_heap(std::begin(boundry), std::end(boundry), std::bind(&Zone::order, this, _1, _2));
        }
        void pop()
        {
            using namespace std::placeholders;
            //std::pop_heap(std::begin(boundry), std::end(boundry), std::bind(&Zone::order, this, _1, _2));
            boundry.pop_back();
        }
        Point top()                 {return boundry./*front*/back();}
        void addZoneBoundry(Zone const& src)
        {
            boundry.reserve(boundry.size() + src.boundry.size());
            using namespace std::placeholders;
            for (auto const& p: src.boundry) {
                boundry.emplace_back(p);
                //std::push_heap(std::begin(boundry), std::end(boundry), std::bind(&Zone::order, this, _1, _2));
            }
        }
};

class Maze
{
    std::vector<std::vector<int>>   maze;
    std::vector<Zone>               zoneInfo;
    std::map<int, int>              zoneMap;

    public:

    Maze()
    {
        zoneInfo.reserve(1000);
    }
    void clear()
    {
        maze.clear();
        zoneInfo.clear();
        zoneMap.clear();
    }

    std::istream& read(std::istream& str)
    {
        clear();

        int r;
        int c;
        str >> r >> c;
        str.ignore(-1, 'n');

        maze.resize(r);

        std::string line;
        for(int loopY = 0; loopY < r; ++loopY)
        {
            maze(loopY).resize(c);
            for(int loopX = 0; loopX < c; ++loopX)
            {
                char v;
                str >> v;
                maze(loopY)(loopX) = v - '0';
            }
        }
        return str;
    }

    int const&  loc(Point const& point) const   {return maze(point.first - 1)(point.second - 1);}
    int&        loc(Point const& point)         {return maze(point.first - 1)(point.second - 1);}
    char type(Point const& point) const
    {
        int l = loc(point);
        if (l < 100) {
            return l + '0';
        }
        return zoneInfo(zone(point)).getType();
    }

    Zone& getCurrentZone(Point const& point, Point const& dst)
    {
        int l = loc(point);
        if (l >= 100) {
            l = zoneMap(l - 100);
            zoneInfo(l).updateDestination(dst);
            return zoneInfo(l);
        }
        zoneMap(zoneInfo.size()) = zoneInfo.size();
        zoneInfo.emplace_back(type(point), zoneInfo.size(), dst);

        Zone& cZ = zoneInfo.back();
        loc(point)      = cZ.getId() + 100;
        cZ.push(point);
        return cZ;
    }

    void tryAdding(Zone& cZ, Point const& next, int v, int h)
    {
        Point point = next;
        point.first  += v;
        point.second += h;

        if (point.first <= 0 || point.first > maze.size() ||
            point.second <= 0 || point.second > maze(0).size() ||
            type(point) != cZ.getType())
        {
            return;
        }

        int l = loc(point);
        if (l < 100)
        {
            loc(point) = cZ.getId() + 100;
            cZ.push(point);
        }
        else
        {
            int currentDest = zoneMap(l - 100);
            if (currentDest != cZ.getId())
            {
                for(auto& item: zoneMap) {
                    if (item.second == currentDest) {
                        item.second = cZ.getId();
                    }
                }
                cZ.addZoneBoundry(zoneInfo(currentDest));
            }
        }
    }

    // Basically Dijkstra algorithm,
    // Returns '0' '1' if the src and dst are the same type and can be reached.
    // returns another letter for a failure to connect.
    char route(Point const& src, Point& dst)
    {
        // The zone contains the boundry list.
        // If the src already exists in a searched zone then
        // re-use the zone and boundary list so we don't have
        // to repeat any work.
        Zone& cZ = getCurrentZone(src, dst);

        // Different types immediately fails.
        if (type(dst) != cZ.getType()) {
            return 'F';
        }

        // If we know that both points are in the same zone.
        // We don't need to expand the boundary and simply return.
        if (zone(dst) == cZ.getId()) {
            return cZ.getType();
        }

        // Otherwise expand the boundary until both
        // points are in the zone or we can't expand anymore.
        while(!cZ.empty())
        {
            Point next = cZ.top();
            if (next == dst) {
                // next location is the destination we have
                // confirmed we can get from source to dest.
                return cZ.getType();
            }

            // Only remove next if we are going to expand.
            cZ.pop();

            tryAdding(cZ, next, -1, 0);
            tryAdding(cZ, next, +1, 0);
            tryAdding(cZ, next, 0, -1);
            tryAdding(cZ, next, 0, +1);


            // This extra check is needed because
            // zones may have been combined. Thus it checks
            // to see if the two points are now in the same zone
            // after combining zones.
            if (zone(dst) == cZ.getId()) {
                return cZ.getType();
            }
        }
        return 'F';
    }

    friend std::istream& operator>>(std::istream& str, Maze& dst)
    {
        return dst.read(str);
    }
};

int main()
{
    Maze        maze;
    std::cin >> maze;

    int count;
    std::cin >> count;
    Point src;
    Point dst;
    for(int loop = 0;loop < count; ++loop)
    {
        std::cin >> src >> dst;
        switch (maze.route(src, dst))
        {
            case '0': std::cout << "binaryn";break;
            case '1': std::cout << "decimaln";break;
            default:
                      std::cout << "neithern";
        }
    }
}

❓ASK – Do people watch videos than reading blogs? | Proxies123.com

I have a question as an owner of a blog, want to know writing is beneficial or a YouTube channel?
I have seen people have earned a lot of money on YouTube by their videos within two years of works.

Writing blog for tech and review still seems very difficult.

websites – What kind of (legal, moral) service would people pay me Bitcoin for?

I’m desperately trying to make money. I barely have the energy to type this, but I need to press on. Bitcoin is the only feasible option left for me.

I’m trying to determine some kind of web service, e-mail service or some kind of database/system involving some sort of data processing by me which is valuable to others, and which would make them want to pay me Bitcoin for.

I have no idea how I’m going to be able to market it, and I don’t even know what I could possibly provide that anyone would actually want to pay for. Bitcoin people seem extraordinarily difficult to convince, probably because they are more intelligent than the general public.

Of course, there is no shortage in my head of “random ideas” which “would be fun”, but I’m way past that point now where I can afford to do things because they are “fun” or “interesting”. I need something which people want and which I can provide.

One major issue is that I’m so painfully different from people myself, so nothing that I would like myself is of any interest to others. Besides, since I’ve never had money to spend, it’s hard for me to know what others would pay for. It seems like they pay for all kinds of stupid things, but that’s likely due to the sellers’ ability to market their stuff to large numbers of not-very-smart people.

I’m not expecting you to reveal your secret trick to make money. I’m requesting reasonable ideas of reasonable services that somebody reasonably intelligent can come up with. Feel free to brainstorm, as long as you take this seriously. Because I certainly do. My future depends on coming up with something very soon.

development – The complete indifference by Bitcoin people is making me lose my enthusiasm for Bitcoin

I’ve been eagerly trying to spread the word about Bitcoin and running “Bitcoin Core” for a decade now. Every day, I hold on to this hope that it’s going to explode “any day now”… but it never happens.

Other than the sheer lack of adoption, I also can sense a horrible indifference by the Bitcoin developers. My Bitcoin Core is yet again in some bizarre state where it says “5 days left” (to sync) every day after it’s already fully synced and got ready yesterday, and remained “fully synced” until I went to bed. Looking at the clock, I wasn’t even asleep for five hours until I came back, started the machine up and yet again: “5 days left”…

The main program, Bitcoin Core, the core (no pun intended) of Bitcoin, is just falling apart and never seems to reach a point of being “ready for the masses”. Hell, the “masses” at this point barely know what a computer even is. All they have now are these surveillance devices (“smartphones”) which are even more fundamentally compromised than our PC hardware and OS (Windows in practice).

I haven’t heard a good Bitcoin news in forever. The price remains absurdly low (compared to what should have happened by now), but that’s not the main point. I don’t know how much longer I can hold on to this hollow, faint hope.

Much like I don’t see any enthusiasm for anything else anymore, both developers and users seem to just “chug along” and see this as some kind of “fun little theoretical hobby”, whereas I view it as a fight literally between life and death. If I didn’t like the banks before, I certainly don’t have any more love for them now that they have made it impossible to even view the account balance in a programmatic manner. They just keep crippling me, while Bitcoin (my savior) goes nowhere.

I want for Bitcoin Core to be stable. I want for Bitcoin to be adopted and used. I want to never have to use “fiat” money again. But it’s not happening. I can’t help but feel completely disillusioned at this point. “Let down” by the community; by people overall.

Instead of a wonderful, exciting new future of opportunities, all I see is tumbleweed and indifference from the few walking ghosts from the past who still retain any kind of knowledge of privacy and freedom. Scammers and scumbags have destroyed the reputation of Bitcoin and the “altcoins” are so obscure it’s not even meaningful to mention them at all.

What can I possibly do at this point other than sitting around and hoping for people to start caring and not remain slaves? They most certainly don’t listen to me, that’s for damn sure…

Do you know how many people are online social media worldwide? – Social Media Marketing (SMM)

More than 4.5 billion people now use the internet, while social media users have passed the 3.8 billion mark. That means about 60 percent of the world’s population is already online !

Click here to learn what that means to your social media marketing approach.

social media facebook GIF

novice users – Good resources for designing for non-technical people

The best resource is going to be your target audience – They will tell you exactly what works and what doesn’t.

Start with talking to some of them to find out who they are and what motivates them. use this to build personas that you can use to understand how your average user might react to the product. You can also start to build a set of requirements that users need to have satisfied by your product.

Then build up a loose prototype and have some more people try using it. Ask them to perform specific tasks based on where the business requirements meet the user requirements and note how well or badly the users are able to complete them – This will show you where your interface is working and where it’s not.

Iterate with more interviews and more prototyping until your are confident that you have a product you are ready to release.

Helloo bmf people | Proxies123.com

Earnings Disclaimer:  All the posts published herein are merely based on individual views, and they do not expressly or by implications represent those of Proxies123.com or its owner. It is hereby made clear that Proxies123.com does not endorse, support, adopt or vouch any views, programs and/or business opportunities posted herein. Proxies123.com also does not give and/or offer any investment advice to any members and/or it’s readers. All members and readers are advised to independently consult their own consultants, lawyers and/or families before making any investment and/or business decisions. This forum is merely a place for general discussions. It is hereby agreed by all members and/or readers that Proxies123.com is in no way responsible and/or liable for any damages and/or losses suffered by anyone of you.

jsom – SharePoint client side people picker

Please try this..this is working code in my environment.

HTML:

<div class="form-group">
    <label id="Name">Employee Name<span class="error-msg">*</span>
    </label>
    <div id="txtName"></div>
</div>

JS:

<script type="text/javascript" src="https://sharepoint.stackexchange.com/<siteurl>/_layouts/15/sp.core.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/clienttemplates.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/clientforms.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/clientpeoplepicker.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/autofill.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/1033/sts_strings.js"></script>


<script type="text/javascript">
    $(document).ready(function() {
        initializePeoplePicker('txtName');
    });

    function initializePeoplePicker(peoplePickerElementId, Users) {
        if (typeof(Users) == 'undefined') Users = null;
        // Create a schema to store picker properties, and set the properties.
        var schema = {};
        schema('PrincipalAccountType') = 'User,DL,SecGroup,SPGroup';
        schema('SearchPrincipalSource') = 15;
        schema('ResolvePrincipalSource') = 15;
        schema('AllowMultipleValues') = false;
        schema('MaximumEntitySuggestions') = 50;
        schema('Width') = '280px';
        this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, Users, schema);
    }
</script>

sharepoint online – auto re-assign “created by”, following validation error from people picker

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

document set – People column not showing up in Word quick parts

I have a People column in my document library, and I have added it to my Document Set. I have also checked the People column to be a shared column in the Document Set Settings. I have other columns set up this way (e.g. managed metadata search tags).

I have a Word document set as Default Content for the document set. I want to include the People in the document using Quick Parts, but I don’t see it under Document Property. I would think I didn’t set up my Document Set columns properly, except my other column (Search Tags) is visible. How can I get People to show up in my Word document?

enter image description here

My Sharepoint site is part of an Office 365 Group. Thanks!