Perl6 variable regex and capturing groups

When I make a regex variable with capturing groups, the whole match is OK, but capturing groups are Nil.

my $str = 'nn12abc34efg';
my $atom = / d ** 2 /;
my $rgx = / ($atom) w+ ($atom) /;

$str ~~ / $rgx / ;
say ~$/;  # 12abc34
say $0;   # Nil
say $1;   # Nil

If I modify the program to avoid $rgx, everything works as expected:

my $str = 'nn12abc34efg';

my $atom = / d ** 2 /;
my $rgx = / ($atom) w+ ($atom) /;

$str ~~ / ($atom) w+ ($atom) /;
say ~$/;  # 12abc34
say $0;   # 「۱۲」
say $1;   # 「۳۴」

لینک منبع

bar chart – Color coding stacked barplots by groups in R using barplot()

My goal is to create a stacked barplot in R from a matrix, where each column in the matrix is a bar with a different color, and each bar represents the sum of all rows in the column.

Here’s dummy data and bar plot scripts I’m using to trouble shoot:

m = matrix(1:9, ncol = 3, byrow = TRUE)
v = matrix(c("red", "blue", "green"), ncol=3, nrow=3, byrow=TRUE)
m #matrix of values
v #matrix of colors for each point

If I only plot row 1, colors are assigned correctly

barplot(m[1,], col=v[1,])

If I plot rows 1-3 w/o designating colors, data is stacked correctly:


If I plot rows 1-3 with BESIDE=TRUE, color codes correctly (but obviously is not stacked)

barplot(m[c(1:3),], col=v[c(1:3),], beside = TRUE)

If I attempt to plot rows 1-3, data stacks correctly, but color coding is not applied as needed:

barplot(m[c(1:3),], col=v[c(1:3),])

Any suggestions?

لینک منبع

The Electronic Frontier Foundation issues a warning to companies banning hate groups

The Electronic Frontier Foundation has a message for the tech companies that have been banning hate groups — be very careful.

The EFF, a nonprofit that focuses on “defending civil liberties in the digital world,” published a post on Thursday night that warned against the precedents set by the ongoing crackdown by major tech companies on websites like The Daily Stormer, a message board popular among the far right, including white supremacists and neo-Nazis.

“All fair-minded people must stand against the hateful violence and aggression that seems to be growing across our country. But we must also recognize that on the Internet, any tactic used now to silence neo-Nazis will soon be used against others, including people whose opinions we agree with,” wrote EFF staffers Jeremy Malcolm, Cindy Cohn, and Danny O’Brien.

Major tech companies have been cracking down on hate groups like never before in the wake of violence during protests in Charlottesville, Virginia. One woman died after a man with ties to far-right organizations allegedly drove his car into a group of counter-protestors.

Since then, Google, Facebook, Spotify, Squarespace, and other companies have taken action, garnering a mostly positive public response. 

The EFF’s post doesn’t come as a surprise; the organization is known to advocate against censorship on the internet.

The EFF noted that companies can choose what kind of speech to allow, but warned that companies are entering dangerous territory because of how much power they wield.

“We strongly believe that what GoDaddy, Google, and Cloudflare did here was dangerous. That’s because, even when the facts are the most vile, we must remain vigilant when platforms exercise these rights. Because Internet intermediaries, especially those with few competitors, control so much online speech, the consequences of their decisions have far-reaching impacts on speech around the world,” the post stated.

The EFF also warned that such action could be taken against anyone. 

“We would be making a mistake if we assumed that these sorts of censorship decisions would never turn against causes we love,” the post stated.

The EFF post had some supporters, most notably Cloudflare CEO Matthew Prince. Cloudflare ceased doing business with The Daily Stormer and characterized the move as his unilateral decision. The company has traditionally maintained a hardline against censoring anything on the internet. While holding to the decision, Prince noted that the EFF post was “exactly on point.”

Others also applauded the EFF’s stance.

Others weren’t as convinced, arguing that the EFF downplayed just how toxic these groups have become.

Https%3a%2f%2fblueprint api uploaders%2fdistribution thumb%2fimage%2f81242%2fb6d3a512 c741 4ae5 9f87 ef4bc2b1cff0

لینک منبع

Algorithm in javascript or python that takes a list of numbers and “groups” them into approximately similar size?

I am looking for an algorithm that takes 2 inputs:

۱) Number of desired groups.
۲) A list of numbers (that may have duplicates)

Output should be the desired groups (with the individual numbers from the original list in them).

How could I accomplish this?

لینک منبع

php – how to show telegram bot keyboard to specific users in groups with mention?

i wrote php code for show keyboard to specific user in telegram bot
but it’s not working

**$keyboradsValue = array(
   array("offtimeon","button 2"),
   array("button 3","button 4"),
$replyMarkup = array(
  'keyboard' => $keyboradsValue,
  'resize_keyboard' => true,
  'force_reply' => true,
  'selective' => true
$encodedMarkup = json_encode($replyMarkup, true);

$url = $website . "/sendMessage?chat_id=-*************&text=@******&disable_web_page_preview=true&reply_markup=".$encodedMarkup;


لینک منبع

What Facebook’s most ‘meaningful’ Groups tell us about Zuckerberg’s grand vision

Facebook’s newest priority isn’t a shiny new technology or a funky new predictive algorithm. It’s Groups, one of the earliest features on 

These aren’t your sophomore year of college Groups though. Facebook is pointing to a series of highly-engaged collectives that highlight why they believe that Groups will play an important part in the future of Facebook—and fulfill CEO Mark Zuckerberg’s goal to “bring the world closer together.”

It comes down to a particular word: “meaningful.”

Facebook’s representatives keep coming back to this word when discussing Groups. Maybe that’s because the feature initially lent it self to jokes like “Bring Back The Jello Bears,” which I championed back in 2007. 

This all happened somewhat off of Facebook’s radar. Groups like Pantsuit Nation amassed hundreds of thousands of engaged members. Many Groups have developed important use cases which even top Facebook executives were unaware of until they began traveling the world and interviewing users about why they use the site. 

“A lot of Groups came and went,” said Facebook Chief Product Officer Chris Cox earlier this year in an interview. “If you just looked at the average Facebook Group you maybe wouldn’t find it something that’s deeply meaningful. But if you go and study, just asking people all around the world what the most meaningful experience you have with Facebook, you started discovering these Groups.”

But just what Groups are “meaningful” on Facebook? We can gleam some insight from the list of people—all administrators of Facebook Group—the company invited to its first-ever Facebook Communities Summit in June. 

A Facebook representative shared with Mashable a list of seven different Groups: 

  • FIN (Female IN): a private, women-only group described as a “no-judgment support group for women” and includes personal stories from women of African culture around marriage, sex, health issues, beauty tips, parenting, domestic violence, mental health, work challenges, and loss

  • Black Fathers: a private men-only group described as “dads doing our thing” and includes men asking each other questions about raising teen girls and custody disputes

  • Keep Austin Fishing!: an open group described as a “fishing family” where people in the area are invited to chat about fishing 

  • Lady Bikers of California: an open group for women who ride motorcycles, with meet-ups in real life and planning of group rides 

  • Affected by Addiction Support Group: a private group for people recovering from addiction and their friends and family to offer support and share stories 

  • Moms of Beverly: an open group for moms in Beverly, Illinois to meet up and ask for advice 

  • Bethel Original Free Will Baptist Church: an open group for members of the Bethel Church in Decatur, Georgia, includes announcements about events, meetings time and also uses Facebook Live to share sermons 

These Facebook Groups are all over America and include people of all different demographics. What they have in common is being deeply personal but not necessarily inclusive of people already within a Facebook’ user’s social network. They bring real world interests and activities online, connecting users to people who they may have never met in real life.

It’s a goal that has drawn comparisons to Reddit, which has subgroups that serve a similar use case by connecting people over topics of discussion. But unlike Reddit, Facebook is not anonymized. The social network prides itself on a real name policy, where even drag queens and sexual assault survivors who wish to use different names are forced to oblige with the rules. 

Facebook’s Groups are meant to be safe spaces, where trolling is more difficult in an online environment that does not allow users to hide behind a made-up username like on Reddit, Tumblr, or Twitter. 

Facebook also has a bit of overlap between Groups and Pages. While the former is focused on interest-based communities, the latter can be dedicated to a person or an organization. For example, Mashable has a Facebook Page where we share our stories. But now, as part of this new Groups push, Page owners can promote Groups. For example, The New Yorker has a Facebook Group for its Movie Club. 

This new emphasis on meaningful communities can be a good service for people, as Facebook CEO Mark Zuckerberg emphasized in his 6,000-word manifesto titled “Building Global Community” earlier this year. 

It’s also a smart business strategy. Facebook is trying to address its other big problem—declining engagement among its users. Facebook makes money when people spend time on its platform, so it needs people putting up stuff and liking/commenting on that stuff. 

Groups, it seems, is key to creating a better world through Facebook, which inevitably means spending more time on Facebook. More people spending more time means more money for Facebook. 

Facebook follows the money, just like any successful business. How does a social network make money? Advertising.

To capture ad budgets, you need engagement. Facebook has 2 billion monthly active users, and yet, advertisers still say “Snapchat” when you ask where to find a younger audience. There’s the fear that Facebook is becoming “old news” combined with the bad public image of being a distributor of “fake news.” 

But people will always have passions and if Facebook can provide the best place to dive deep into those passions, they have your attention, and therefore, they have money. 

Whether Groups are good or bad isn’t really the question. They’re engaging, or “meaningful,” in Facebook parlance. uploaders%2fdistribution thumb%2fimage%2f80762%2f373b17f2 226a 4371 bca6 1618cff8be8d

لینک منبع