As developers for tablets and smartphones we like to keep abreast of the latest mobile technology developments . This is a daily digest of mobile development and related technology news gathered from the BBC, the New York Times, New Scientist and the Globe and Mail to name a few. We scour the web for articles concerning, iPhone, iPad and android development, iOS and android operating systems as well as general articles on advances in mobile technology. We hope you find this useful and that it helps to keep you up to date with the latest technology developments.
- 'Selfie,' 'Twerk' And 'Hashtag' Top Annual Most Annoying Word List
DETROIT (AP) — A Michigan university has issued its annual list of annoying words, and those flexible enough to take selfies of themselves twerking should take note.
In addition to “selfie” and “twerking,” there was a strong sense among those who nominated words to this year’s list that the word “hashtag” and term “Mr. Mom” had both run their course. “Selfie,” a term that describes a self-taken photo, often from a smartphone, led the way among the more than 2,000 nominations submitted to Lake Superior State University’s 39th annual batch of words to banish due to overuse, overreliance and overall fatigue. Even President Barack Obama got into the act this month when he took a well-publicized selfie with other world leaders in South Africa for Nelson Mandela’s memorial service.
“It’s a lame word. It’s all about me, me, me,” wrote David Kriege of Lake Mills, Wis. “Put the smartphone away. Nobody cares about you.”
Since 1975, the list has grown to more than 800 words, many from the worlds of politics, sports and popular — maybe too popular — culture.
“The list is made up completely from nominations. We don’t just sit around and think of words that bug us,” said Tom Pink, a spokesman for the school in Sault Ste. Marie, in Michigan’s Upper Peninsula.
“Twerk” or “twerking,” a sexually provocative way of dancing, found a dominant place in parlance due to Miley Cyrus’ performance at the MTV Video Music Awards.
“Time to dance this one off the stage,” said Jim Connelly, of Flagstaff, Ariz.
“Hashtag” refers to a word or phrase with no spaces preceded by the pound sign on the microblogging website Twitter.
Others on the banned list include “Twittersphere,” ”t-bone,” ”Obamacare” ”intellectually/morally bankrupt” and anything “on steroids.” People also tired of the suffixes “-pocalypse” and “-ageddon” used to make words such as “snow-pocalypse” or “ice-ageddon.”
And enough already with “Mr. Mom,” a reference to fathers who take care of kids. It’s also the name of a 1983 movie starring Michael Keaton, although many stay-at-home dads these days don’t like the movie stereotype of a clueless male.
“There were almost as many nominations for ‘Mr. Mom’ as ‘selfie’ and ‘twerk,'” Pink said.
He believes the title got traction again in 2013 due to news stories about the 30th anniversary of the movie.
“The phrase should refer only to the film, not to men in the real world,” wrote Pat Byrnes of Chicago. “It is an insult to the millions of dads who are the primary caregivers for their children. Would we tolerate calling working women, ‘Mrs. Dad?'”
“Adversity” and “fan base” — terms often used when discussing sports — got booed. Kyle Melton, of White Lake, Mich., said perspective is needed when referring to a millionaire athlete trying to get a first down in football.
“Facing adversity is working 50 hours a week and still struggling to feed your kids,” Melton wrote.
___
Online:
http://www.lssu.edu/banished/
___
Follow Ed White on Twitter at https://twitter.com/edwhiteap .
- Sony troubles persist: Factories said to be target of staff cuts
Sony is trying to make its consumer electronics business profitable. And that appears to require more cuts at production facilities.
- 'Gift tweets' reveal overwhelming popularity of iPad, iPhone
As is usually done after the holidays, a survey of tweets bragging that someone “got an iPad” or “Got a Kindle” on Twitter has shown yet again that iOS devices are in a class by themselves when it comes to owner pride or excitement — and provides yet another real-world indicator that end-user sales of competing devices may not match up with “shipments” reports. A test by Topsy Analytics found that iOS devices still have no real rivals.
- HP adds another 5,000 jobs to layoff plan for 34,000 total
Computer giant is increasing the number of positions it expects to eliminate as part of a years-long turnaround plan.
- Briefly: FitBit adds MobileTrack, new Python Mac charger protector
FitBit has announced an update to its iOS fitness app, released today in the App Store. FitBit allows users to monitor their exercise activity with their iPhone, track their stats and set fitness goals. Version 2.1 of FitBit features MobileTrack, which utilizes the M7 coprocessor in the iPhone 5s to track basic activity as it occurs.
- First Sex Doll Launched Into Space And Floats Until She Blows.. Up
It’s happened. We finally launched a sex toy into the final frontier. Go America?
The inflatable sex doll named Missy was launched near Lake Tahoe, Calif., by one of the worlds largest distributors of adult products, CNV.com Inc.
With the help of a hydrogen filled 4.5 pound balloon, the doll climbed over 100,000 feet above earth at a rate of 1,400 feet per minute. Apparently sex dolls can endure a lot, because Missy’s hot bod held up to extreme temperatures, air pressure and cosmic ray radiation.
These sex toy makers aren’t f****** around.
Missy’s material didn’t even deteriorate when temperatures got as low as -70 degrees Fahrenheit, or when she traveled against jet stream winds over 100 miles per hour.
Cosmic ray radiation was around 100 times its earthly strength, and the atmospheric pressure was less than one percent of the earth’s atmosphere. Missy still held together without bursting… with pleasure.
In the video description CNV owner, Dave Levine, says, “We modified the air plug on the back so that it equalized with outside pressure throughout the flight. The doll was just filled with air, but enough was allowed to vent during the course of the flight so as to prevent explosion.”
It wasn’t until Missy’s helium balloon (cherry) popped at 102,000 that she began to fall to earth, and be ripped to shreds by the atmosphere somewhere over the Nevada desert. We guess she found her G… force.
C’est la vie.
One small step for sex dolls. One giant step for… sex dolls.
- Moshi Monsters boss honoured
Michael Acton Smith, founder of the firm behind Moshi Monsters, and Warren East, ex-chief executive of chip designer ARM, are named in the New Year’s Honours List.
- ACLU Sues NSA For Details Of U.S. Surveillance Under Executive Order
By Nate Raymond
NEW YORK, Dec 30 (Reuters) – The American Civil Liberties Union filed a lawsuit Monday seeking to force the U.S. government to disclose details of its foreign electronic surveillance program and what protections it provides to Americans whose communications are swept up.
The lawsuit, filed in U.S. District Court in New York, came three days after the ACLU lost a bid to block a separate program that collects the phone calls of millions of Americans.
The latest lawsuit seeks information related to the use of Executive Order 12333, which was signed in 1981 and governs surveillance of foreign targets.
Under the order, the National Security Administration is collecting “vast quantities” of data globally under the order’s authority, “inevitably” including communications of U.S. citizens, the lawsuit said.
The lawsuit cites “recent revelations,” an apparent reference to reports about U.S. spying activities in the wake of leaks by former NSA contractor Edward Snowden.
“This FOIA request seeks, in part, to determine what protections are afforded to those U.S. persons and whether those protections are consistent with the Constitution,” it said.
A representative for the Justice Department, which will defend the lawsuit, did not immediately respond to a request for comment.
The lawsuit follows a series of requests to U.S. agencies for the information under the Freedom of Information Act, which it said have not resulted in substantive responses.
Alex Abdo, an ACLU staff attorney, said in a blog post that the government was using the order as a way to spy on the international communication of U.S. citizens.
“The core of the problem is that the NSA has, for years, relied upon its authority to gather foreign intelligence as permission to conduct sweeping surveillance of Americans’ international communications,” Abdo wrote.
The lawsuit cites news reports indicating that under the order, the NSA is collecting data on cell phone locations and email contact lists, as well as information from Google Inc and Yahoo! Inc user accounts.
Among the records sought by the ACLU are any construing or interpreting the scope of agencies’ authority under the executive order.
It also seeks records describing minimization procedures used by the agencies related to intelligence collection and interpretation pursuant to the order.
The lawsuit names as defendants the NSA, Central Intelligence Agency, Defense Department, Justice Department and State Department.
The case is American Civil Liberties Union et al v. National Security Agency et al, U.S. District Court, Southern District of New York, No. 13-9198. - NSA Uses Windows Error Messages To Spy On People
Usually an annoying popup brushed aside with a click, error messages on Microsoft’s Windows operating system may also serve as a way for the National Security Agency to spy on you.
When a Windows program seizes up, someone using a PC can choose to send an error report to Microsoft for review. But Windows owners may inadvertently be sending those error reports to the NSA too, according to a report on Sunday by German magazine Der Spiegel detailing the work of the Tailored Access Operations division of the NSA, which is considered the agency’s top hacking unit. The revelations come from the latest document leaks of former NSA contractor Edward Snowden.
An NSA presentation obtained by Der Spiegel noted that the crash reports are a “neat way” to gain “passive access” to a machine. The team can use the NSA’s massively powerful sleuthing software to cherry-pick error reports from the global stream of Internet traffic. Only data sent from a computer can be collected this way, but it can give the NSA something crucial for further hacking: the vulnerabilities of a target’s computer.
One internal graphic suggests NSA agents mocked how easy the Windows error messages made their jobs:
Like other tech companies, Microsoft has been in a tough position since Snowden’s leaks began. A report from The Guardian in July found that the company may have handed the NSA access to the customers’ encrypted messages and data. In recent months, Microsoft has attempted to assuage fears of government surveillance by fighting against any attempt by U.S. intelligence agencies to seize its foreign customers’ data under American surveillance laws.
“Microsoft does not provide any government with direct or unfettered access to our customer’s data,” a Microsoft representative said in response to the latest allegations. “We would have significant concerns if the allegations about government actions are true.”
- Meet The People Who Think America Is 2014 Years Old
Ah, the good ol’ U. S. of A. Land of the free, home of the uninformed.
According to Twitter, more than a few people believe that the United States was formed 2014 years ago, and that New Year’s Day is America’s birthday. There is so much about this idea that doesn’t make sense. If New Year’s is America’s birthday, is it a different year in different countries? Did you never take any history class or speak to another human being?
Maybe some of these people are joking. PLEASE let them be joking.
America isn’t even 2014 years old guys, you didn’t take lap years and daylight savings into consideration. It’s already 2021 years old.
— chris (@ChrisDoublesky) December 30, 2013
It is crazy to me that in a couple days America will be 2014 years old!!!!! WOW
— andrew madison (@b0ner_soup) December 30, 2013
How is America already 2014 years old #wow
— Kyle (@KyleDrapikowski) December 30, 2013
wow I can’t believe America is turning 2014 years old soon
— r. kelly (@MattBengtson) December 24, 2013
Wait is America 2014 years old? Like that is a deep question.
— Ashlyn Powers (@AshlynReneeP) December 30, 2013
Hard to believe that it’s almost here. America is gonna be 2014 years old. Think about that for a minute. That’s SUPER old, guys.
— J.Lu (@JRLu) December 30, 2013
Wow! Can’t believe America is nearly 2014 years old! #happybirthday #landofthefree #homeofthebrave
— Mister Cowley (@MisterCowley) December 28, 2013
I can’t believe in a week America is turn 2014 years old! Yay us!
— Arthur Elkind (@arthurelkind) December 23, 2013
Not only that, but many people also think that the Earth is turning 2014 years old for some reason.
4 DAYS UNTILL THE EARTH IS 2014 YEARS OLD !!!! pic.twitter.com/KX2Y8k6Edf
— Psycho Prince (@CharlieThomas_) December 28, 2013
Can’t believe the Earth is almost 2014 years old.
— Older Freezy (@jfrebe) December 25, 2013
Earth is almost 2014 years old wow.
— Carlos (@hoesanddrugs) December 25, 2013
can you believe in just 6 days the earth will be 2014 years old!!
— Brandon :^) (@canihashtagthis) December 26, 2013
9 days from now, Earth will turn 2014 years old. Happy 2014th birthday, Earth!
— WOOOOOOOOO 2014 (@FWBluesFan) December 23, 2013
Save us.
- Somebody Brought Emoji To Life, And They're Awesome
It’s a stretch to say that the emoji you text your friends are high art. But the real-life recreations of those same smiley faces? That’s a different story.
“They’re really quite stupid,” Liza Nelson wrote of emoji on her website. “And they’re the best thing that ever happened to our generation. They deserve to be observed and worshipped individually.” So the Los Angeles-based artist reenacted some of her favorite Japanese emoticons with papier mâché, cardboard, paint and a few living humans.
Others have found artistic inspiration in emoji as well. Earlier this year, artists Luciel Perte and Noah Spidermen created a video of a swirling kaleidoscope of emoji, narrated by Siri describing the different images. Another artist, Carla Gannis, covered an image of the “Garden of Earthly Delights” by 16th century painter Hieronymus Bosch with emoji of all shapes and sizes. And earlier in December, Fito Segrera presented a performance piece in which muscle simulators contorted his face into the shape of some of the better known icons.
Here are some of Nelson’s pieces:
ALL WET
DRUGS
GODDESS
MURDERBALL
MUSTACHE
POUND IT
PRAISIN
THAT PURP
WHO, ME?
YUSSS
- A.I. Sex: It's Complicated, Too (NSFW)
The runaway success of Spike Jonze’s new movie Her owes much to its already over-analyzed single sex scene — virtual, of course. The subsequent effusion of articles about interactive sex experiences concentrates on the technical stuff that can assist in creating “the closest thing to the real thing” — while forgoing all the drama, uncertainty and messiness in having to deal with an actual sex partner: How to find him/her? How to try for the serendipitous occurrence of mutual desires and appetites? What to do afterwards?
The hi-tech gizmos already in play are multiple and diverse, and all grounded in the basic assumption that any encounter that seeks to be intimate has to be both visual (hence the necessary interplay with a webcam) and sensory (hence the electronically operated machinal devices).
Some rely on a traditional foundation, like 3D-printed sex toys and the Limon (Minna Life). Basically a vibrator, it ostensibly can also serve as a couple’s sexual memory-bank, recording and customizing intensity levels.Something equally reliant on the here and now, using technology in an auxiliary way, is a new unisex product Durex, the condom colossus, has in the works. Fundawear, “touch over the internet” as aptly defined by the company, consists of, according to a YouTube video, a pair of underpants — available in male and female versions — with built-in vibrating nodes remotely activated and operated by an iPhone.
The app’s menu is quite evolved, involving a multitude of on-screen “buttons” that each operate different nodes, allowing for a more customized — should we say “personal”? — experience mirroring what the couple would do in a “real” intimate set-up.
Then there are the gizmos heavily reliant on technology allowing not just for the recording and digital transmission of sexual sensations, but also — to a degree — for their simulation.
One of these is RealTouch, a product line of USB-connected sex devices (one device curated for straight men, another for gay men), promising actual “interactive sex” over the Internet. The customer can choose from over 1000 specially encoded videos that sync with the movements of real touch, while for those who apparently desire to forego the slog of acquiring and/or maintaining a significant other, the company also delivers access to a slew of “models” well-versed in the use of RealTouch’s devices, who are available “for private, one-on-one fantasy encounters.”
All this for a price, of course, unlike a failed sexual encounter involving a real-life volunteer surrogate in Her.
Yet, this newly garnered ballyhoo about hi-tech gizmos offering interactive sexual experiences, most of which have already been around for several years now, entirely ignores the fact that even in Her‘s image of a dystopian future not far from us, the single — and ostensibly mind-blowing and physically orgasmic — sex scene relies on no remotely operated nodes, special underwear, or USB devices, no significant other, surrogate, or model on the other side of the Internet. It consists of the act of verbal foreplay between two entities (how else to speak about the coupling of a human being and an artificially intelligent operating system the human has downloaded onto his phone, computer and other devices?) only after the two have become familiar, shared intimately mundane details about their likes and dislikes, become a staple of each other’s daily lives, and therefore forged a strong intellectual and emotional bond.
To put it plainly: it’s about two… beings who have opened up to one another, gotten to know each other, fallen in love, and require nothing more than each other’s voice and the all-pervasive knowledge of the intensity of their bond, to reach mutual physical climax — giving a whole new meaning to the term “mind-f*ck”.
After that happens, of course, things start getting messy. In the movie, as in real life, truly mind-blowing sex entails a profound and unique, if also febrile, connection to a specific other on every level. Enter drama and potential heartbreak. Even if your lover is a creature of A.I. (and this option seems not too faraway; aside from Japanese DARPA robots and Google’s much publicized forage into robotics Rumors abound that Google has made ground-breaking progress in creating software that understands and responds accordingly to the diverse employment of inflection, both written and spoken.
Practically meaning, this software (still in its experimental phase) understands when we’re joking or being mysterious or just sad — at the same time, this lack of emotional understanding remains a timeless bone of contention between many couples.
Truth is, we’re all products of a higher intelligence after all — some call it God, others call it “evolution”. When we break out, evolving beyond our “programming”, risking, feeling, discovering, truly connecting to another, then it all becomes complicated and unknown. That’s the goriness and glory of love, I guess.
- 11 Reasons You Should Quit Facebook In 2014
“Facebook is so annoying.” How many times have you heard that sentiment this past year? We bet a lot, because more and more people seem to be getting tired of the social media platform, especially young people.
We’ve noticed a nationwide annoyance with Facebook over 2013. The company even admitted in October that younger teens were using the network less frequently on a daily basis. Here are 11 reasons that might convince you to let your Facebook account go in 2014.
1. Nobody actually wants to just read about what you’re doing anymore.
Think about it: What sounds more appealing (and believable)? Reading a status that says, “I’m currently hanging out with Will Smith!” or a picture of that person actually posing with Smith? A photo is definitely more engaging. Here’s the most-liked Instagram picture of 2013: Justin Bieber’s snap with Smith.
When TIME interviewed teenagers about their social media use in March, 16-year-old Hamp Briley explained that kids these days don’t have time for Facebook: “Twitter’s all statuses, Instagram’s all pictures. People like to do more specific things like that instead of being on just Facebook.”
2. Facebook makes it impossible for you to stay “private.”
For many valid reasons (think stalker exes or potential employers), some people don’t like having their name come up when it’s typed into the Facebook search bar. However, most users this year found problems with changes to privacy settings. For one, Facebook removed the option to keep your name hidden when people search you. They also forced people to control their privacy settings on a cumbersome item-by-item basis. Today, the only way to make sure certain people can’t access your profile is to block them. Or alter your name so it doesn’t appear when people search your real one. Or, of course, quit Facebook entirely.
3. Your parents (and even grandparents) are now watching your every move.
This year seemed to be the year everyone’s mom, dad, grandmother and great aunt got hooked on Facebook. And that meant every time you posted a status about something innocuous, these Facebook novices started breathing down your neck the minute you hit “post.” We get enough scolding from our parents “IRL” — no need to let it trickle onto a social media site where our friends can laugh at our familial bickering.
4. Or they’re posting photos of you that you would never want anyone to see
What’s worse than getting no “likes” on an Instagram photo you posted? Checking your Facebook and realizing that a horribly embarrassing photo of you that your mom posted is getting over 50 “likes,” along with some pretty serious mockery in the comments section.
5. Facebook is even keeping track of what you don’t say.
You may have been happy you didn’t post that one over-share about your extended trip to the bathroom the other day, but Facebook may have a record of exactly what you typed and what time you were about to publish it. This month, Facebook released a study revealing that they were undergoing a new type of data collection in which they were tracking when people typed content out and then removed it without publishing. Their mission is to understand why users “self-censor” themselves in updates. According to Facebook data scientist Sauvik Das, a “self-censored update” is “an entry into either [a status update or comment box] of more than five characters that was typed out but not submitted for at least the next 10 minutes.”
6. Facebook makes you feel less positive about your life.
Even though the purpose of Facebook is effectively to reveal details about everything and anything you do, access to this knowledge could take a toll on your mental well-being. A recent study done by the Department of Behavioral Science at the University of Utah discovered that heavy Facebook users aren’t the happiest people out there. The researchers found that just using Facebook makes you view your life more negatively. Of 400 students questioned, “those who have used Facebook longer agreed more that others were happier, and agreed less that life is fair, and those spending more time on Facebook each week agreed more that others were happier and had better lives.”
7. The “friend suggestions” tell you to befriend people you don’t even know.
Facebook’s “friend suggestions” algorithm needs some work, because these days we’re discovering that your potential “friends” are people we only know through someone else, or someone we haven’t even met at all. If you want people to stop using a platform that is supposed to connect them and bring them together with the people they care about, you should definitely adopt Facebook’s strategy of trying to get you to care about the lives of complete strangers.
8. You realize you only know and care about only 20 people out of your 1,000 friends.
It starts to get kind of weird when you check the birthdays for the day and don’t remember who any of the five people are. How do you know them? Are they some random person you met at a bar in college one night, and in a drunken stupor decided to “add on Facebook”? Probably. Do you need to know that this person is moving to California this week? More importantly, do you care? Nope. It could be time to overhaul your friends list. Or maybe it’s time to realize that your Facebook account is being used pretty much entirely to keep tabs on these kinds of strangers.
9. Your friends keep announcing their engagements.
There’s nothing more obnoxious than being a busy twentysomething and starting to see all of your friends post statuses about getting engaged. While you are happy for them and wish them the best in their prospects for a lasting marriage, the bombardment of status updates is starting to make you feel like something is wrong with your love life. Why aren’t you getting married? What is wrong with you? Why the hell do you need to be thinking about marriage right now?! Once that anxiety subsides, you realize you have to endure continued updates on their wedding preparation. You could unsubscribe to this friend, but you know more are coming.
10. The excessive ads are about to ruin the whole experience.
If the regular sponsored ads hadn’t already destroyed Facebook for you — seriously, why the hell do you think you’re obsessed with guitars and horses — the upcoming launch of video ads will definitely do the trick. Facebook started testing these annoying ads out in December. They’ll soon be coming to a newsfeed near you, automatically playing a video as you scroll through. However, the sound will only play if you click or tap on it. The good news? There is a way to block these ads from automatically playing. You just have to use a Flash blocker.
11. It makes getting over a breakup really hard.
Back in the days before social media, people broke up and never called the person again. It was relatively simple to move on (providing you weren’t forced to physically see the person on a day-to-day basis). But today, being able to have constant access to your ex’s timeline can easily cause serious obsessive tendencies and behavior. Samuel Axon at Mashable accurately summed up how Facebook makes breakups harder, because the platform makes your change in relationship status public and it allows you to see all the action your ex is getting.
- Dog Who Would Rather Watch TV Than Play Is Probably A Metaphor For Something
Come on, dog, there’s a whole big world out there. Instead of watching TV, play with a friend, chase a ball, make a New Year’s resolution… regular dog stuff. Leave the mindlessly watching whatever’s on the tube to us, the experts.
- Rustic State Machines for Fun and Profit
Rustic State Machines for Fun and Profit
Video games got me into programming, and while I don’t actively try to make games anymore, every now and then I take an interest in what the experts are doing, and occasionally write modules and bindings.
One of the key design patterns I’ve learned since then is the State pattern. Like all young, idealistic game programmers, my first programs were filled with complicated if-else branches that were nearly impossible to update or maintain, yet somehow they worked. The State pattern is something I sorely wish I’d known back then, as it solves the same problem that those if-else branches were intended to solve, but does it in a much cleaner and more modular way. The book-in-progress I linked to above does a great job of describing what the pattern is and sketches out a rudimentary C++ implementation. But C++ is a complicated, often twisted old beast of a programming language, so why not try to implement a state machine in the next-generation game programming language: Rust?
Truthfully, I doubt that Rust will ever knock C++ off of its dominant perch in the game programming industry, at least not for a long while. But it does stand the best chance, as it combines a number of good design ideas with a trait that most new programming languages tend to brush off: speed. While I’m a huge fan of other new languages like Go, mandatory garbage collection is a potential dealbreaker for games that want to milk as much performance out of the system as possible.
Dynamic Dispatch
The State pattern is based on the concept of dynamic dispatch: the ability of a system to determine at runtime which code to run, rather than at compile-time. C++ uses virtual methods, Go uses interfaces, Haskell uses typeclasses, and Rust uses traits.
If you’re familiar with how any of the other languages implements dynamic dispatch, then Rust traits should feel very familiar. A trait is defined by a set of method signatures, each made up of a name, parameter list, and return value. Other types can implement a trait by implementing the methods defined by it. Once implemented, that type can be used anywhere that trait is expected.
So by implementing the game hero’s state as a trait, we can pass game input along to whatever record the hero’s state is currently pointing to, then use its return value to determine if that state should be updated.
In code, here’s what we’d like to be able to do:
This simply defines a State trait (empty for now) and a Hero struct with an inner field pointing to some value implementing State. Then when we want to process some input, we give it to the Hero and let it decide what to do based on its current state. Since we want each possible state to be able to handle its own input, State should consist of a similar, but more specialized, method for input handling. But since the Hero points to the State and not the other way around, how do we tell the Hero whether or not a new state is needed? Consider that there are three possible cases:
- Invalid input.
- Valid input, and the state should change.
- Valid input, but the state should stay the same.
For this solution I’ve decided to represent these three cases using a combination of Rust’s built-in Result and Option types. A Result can represent one of two values, an error or a success, and an Optionsimply represents a value that may or may not be present. When the input fails for any reason, we want to return that as an error. But if it succeeds, we want to be able to optionally return a new state to be used. Here’s how that looks in Rust code:
Note that this is a very simplified example, and in reality, it would also be necessary for handle_input() to take a pointer to Hero or some subset of it. However, this post is written towards a functional programming style, and as such we want to prevent states from modifying the hero’s st field directly, hence this approach.
Here the Res type is equivalent to what I just described, since it has only three possible values:
- Err(...) for an error.
- Ok(Some(...)) for when we want to change state.
- Ok(None) for when we want to keep the current state.
Now we can finish defining the Hero’s handle_input() method, which will serve as the entry-point for any State-defined ones by passing along the input and updating itself based on the result:
For simplicity’s sake, any errors received will simply be printed to standard output.
Writing Some States
Let’s use this to implement two states for the Hero and define some commands for switching between them!
Assume that our hero starts out sitting, so we have a Hero instance whose internal st field points to an instance of Sitting, which is an empty struct as it requires no additional information. But what if our hero wants to eat a burger? We simply tell him to ~[~"eat", ~"burger"], which gets passed along to the sitting implementation of handle_input(). This ends up returning a value of Ok(Some(~Eating as ~State)), which means that we should upate our hero’s state to the provided Eating instance. Eating contains one field, which is the value of the food we instructed him to eat; in this case, ~"burger". This demonstrates how each implementation of State can itself keep track of its own internal state. Telling him to ~[~"stop"] and ~[~"eat", ~"pizza"] would cause our hero to stop eating the burger and pick up a slice of pizza. On the other hand, telling him to ~[~"chew"] while eating or to ~[~"stare"] while sitting will return a value of Ok(None), since he will still be eating or sitting, respectively, after the action has finished.
The full working example can be found here. As an exercise, try downloading the source and implementing a few new behaviors for our intrepid Hero. How would you get him to walk, or sleep? How would he react to a command to ~[~"walk"] while in the middle of a sandwich, or if he was told to ~[~"sleep"] while walking?
- YouTube's Skippable Ads Keep 50% More Viewers
Putting users in control can put publishers at an advantage, it seems. Google’s TrueView video ad format may let users skip YouTube pre-roll ads – but that doesn’t mean reduced engagement, says a company exec.
“One of the most interesting findings that we’ve gotten from TrueView, both on YouTube and also off of YouTube and on the publishers that we have TrueView extended to, is we see a 50% … increase in retention for those publishers – people that come back to the site over and over and over again,” Google’s media platform sales head Jay VanDerzee tells Beet.TV.
TrueView ads let users skip to actual content after a set number of seconds have elapsed. If users skip, advertisers don’t pay.
“All too often people get consumed by those notion of ‘What percentage of people skip the ad?’,” VanDerzee says. “What you really should be thinking about is, ‘What percentage of people didn’t skip the ad, and what is the value created for those publishers and users?’ It’s obviously tremendous.”
VanDerzee was interviewed by Furious Minds CEO Ashley Swartz at Beet.TV’s TV Programmatic Summit, hosted at Xaxis and presented by Videology.
You can find this post on Beet.TV.
- US announces six drone test sites
America’s aviation agency announces the six states that will test commercial drones, a step towards unleashing the pilotless aircraft in US skies.
- People Sext When They Don't Really Want To, Study Finds
“Not tonight, honey, I have a headache” can spare lovers from sex. But it won’t save them from sexts.
While headlines proclaim young adults are hooked on the joys of sexting, a forthcoming study examining the practice has found college-age sexters in committed relationships frequently engage in unwanted sexting, and will exchange explicit message or photos for reasons that have little to do with attraction or arousal.
Call it the “requisext”: an X-rated missive sent out of a sense of necessity or obligation, but not purely for pleasure. They’re more common than many might realize, and are sent nearly as frequently by men and women.
The research, which will be published in February in the journal Computers in Human Behavior, reveals similarities between sexual behavior online and off. Previous research on couples’ sex lives has demonstrated that partners will willingly go along with sex, even when they’re not keen on it, for reasons that range from pleasing their partner to avoiding an argument. On smartphones and over email, e-sex happens for many of the same reasons.
Working to understand the frequency of “consensual but unwanted sexting” — scientist-speak for “sexting when you’re not in the mood” — psychologists at Indiana University-Purdue University For Wayne polled 155 undergraduates who were or had been in committed relationships on their sexting habits.
Fifty-five percent of the female respondents said they had previously engaged in unwanted sexting, while 48 percent of men had done the same. Those numbers are surprisingly similar to previous findings on so-called “compliant sexual activity”: A 1994 report determined that 55 percent of American women and 35 percent of American men had ever engaged in consensual but unwanted sex.
But while women have typically far outnumbered men in having unwanted sexual activity the old-fashioned way, the rates of requisexting were not drastically higher among women, the study found. In this case, equality for the sexes means near-equality in unwanted sexting.
The authors of the article argued “gender-role expectations” could be to blame. Men might be more likely to agree to undesired sexting because doing so is “relatively easy and does not require them to invest more into the relationship.” Women in turn might be discouraged from virtual sex because it fails to help them attain their relationship “goals,” the authors hypothesized.
So what makes people feel the need to requisext — especially when the evidence can so easily come back to haunt them?
The survey’s respondents were asked to rate ten possible motivations for their begrudging sexts, ranging from “I was bored” to “I was taking drugs.”
People most frequently consented to unwanted sexting because they sought to flirt, engage in foreplay, satisfy a partner’s need or foster intimacy in their relationship. The researchers also found that people who were anxious about their relationships — specifically, who feared abandonment by or alienation from their lovers — were more likely to be requisexters. Digital communication could be “especially challenging” for these anxious lovers, who might increase their sexting in an attempt to make distant lovers seem closer, the study’s authors speculated.
On the other hand, those sick of requisexting might soon be coming up with some clever “outs.” Next time, just claim you have a thumbache.
- 17 New Year's Eve Someecards That Will Start Your 2014 With A Laugh
Fact: New Year’s Eve is probably the most overrated night of the year. Make it better for a friend you plan to keep around in 2014 by sending a witty Someecard. They put up with you all year; it’s the least you could do.