At this point we know that the day one launch lineup consists solely of Halo Infinite, Xbox’s flagship franchise. When asked about the launch lineup, Spencer skated around the topic, not really confirming anything new, but instead outlining his own beliefs on how Microsoft will be handling the launch. “For the momentum of the platform, it’s not about any one day, it’s about a sustained stream of great games coming from our first party and our third party partners,” he said.
Spencer went on to comment on how he thought the Xbox One had too many games released on the launch day. "It doesn’t really help somebody to have eight games launched on one day, and I think you can pace those out,” he said.
In this article, you’ll learn the ins and outs of the sorting function in Python. In particular, you’re going to learn how to sort a list of dictionaries in all possible variations. [1] So let’s get started!
How to Sort a List of Dictionaries …
… By Value?
Problem: Given a list of dictionaries. Each dictionary consists of multiple (key, value) pairs. You want to sort them by value of a particular dictionary key (attribute). How do you sort this dictionary?
Minimal Example: Consider the following example where you want to sort a list of salary dictionaries by value of the key 'Alice'.
Solution: You have two main ways to do this—both are based on defining the key function of Python’s sorting methods. The key function maps each list element (in our case a dictionary) to a single value that can be used as the basis of comparison.
Use a lambda function as key function to sort the list of dictionaries.
Use the itemgetter function as key function to sort the list of dictionaries.
Here’s the code of the first option using a lambda function that returns the value of the key 'Alice' from each dictionary:
# Create the dictionary of Bob's and Alice's salary data
salaries = [{'Alice': 100000, 'Bob': 24000}, {'Alice': 121000, 'Bob': 48000}, {'Alice': 12000, 'Bob': 66000}] # Use the sorted() function with key argument to create a new dic.
# Each dictionary list element is "reduced" to the value stored for key 'Alice'
sorted_salaries = sorted(salaries, key=lambda d: d['Alice']) # Print everything to the shell
print(sorted_salaries)
The output is the sorted dictionary. Note that the first dictionary has the smallest salary of Alice and the third dictionary has the largest salary of Alice.
Same Problem: Given a list of dictionaries. Each dictionary consists of multiple (key, value) pairs. How to sort them by value of a particular dictionary key (attribute)?
Minimal Example: Consider again the following example where you want to sort a list of salary dictionaries by value of the key 'Alice'.
Solution: Again, you’re going to define a key function. But instead of creating it yourself with the lambda keyword, you’re going to use an existing one. In particular, you’ll use the itemgetter function from the operator module to sort the list of dictionaries.
Here’s the code of the first option using a lambda function that returns the value of the key 'Alice' from each dictionary:
# Import the itemgetter function from the operator module
from operator import itemgetter # Create the dictionary of Bob's and Alice's salary data
salaries = [{'Alice': 100000, 'Bob': 24000}, {'Alice': 121000, 'Bob': 48000}, {'Alice': 12000, 'Bob': 66000}] # Use the sorted() function with key argument to create a new dic.
# Each dictionary list element is "reduced" to the value stored for key 'Alice'
sorted_salaries = sorted(salaries, key=itemgetter('Alice')) # Print everything to the shell
print(sorted_salaries)
The output is the sorted dictionary. Note that the first dictionary has the smallest salary of Alice and the third dictionary has the largest salary of Alice.
Now, you know how to sort a list of dictionaries by value. But what if you want to sort by key?
… By Key?
Problem: Given a list of dictionaries. Each dictionary consists of multiple (key, value) pairs. How to sort them by a particular key (attribute)?
Solution: It doesn’t make sense. If you assume that all dictionaries have that same particular key, you cannot really sort because all dictionaries have the same key. If there’s no tie-breaker, it’s impossible to do. But even if there’s a tie-breaker (e.g. the value associated to the key), it doesn’t make sense because you could have sorted by value in the first place.
… By Multiple Keys?
Problem: Given a list of dictionaries. How do you sort by multiple key value pairs?
Minimal Example: Consider the following example where you want to sort a list of database entries (e.g. each stored as a dictionary) by value of the key 'username'. If the 'username' is the same, you use the 'joined' value as a tiebreaker. If the 'joined' date is the same, you use the 'age' as a tie breaker.
Solution: You’re going to define a key function with the lambda keyword. But instead of returning a single value to a given key, you return a tuple—one entry per value that should be considered. For example, the database entry {'username': 'Alice', 'joined': 2020, 'age': 23} is mapped to ('Alice', 2020, 23). This ensures that two tuples that have the same first tuple value will still be sorted correctly by using the second tuple value as a tiebreaker.
Here’s the code:
# Create the dictionary of user entries in your database
db = [{'username': 'Alice', 'joined': 2020, 'age': 23}, {'username': 'Bob', 'joined': 2018, 'age': 19}, {'username': 'Alice', 'joined': 2020, 'age': 31}] # Use the sorted() function with key argument to create a new list.
# Each dictionary list element is "reduced" to the tuple of values.
db_sorted = sorted(db, key=lambda row: (row['username'], row['joined'], row['age'])) # Print everything to the shell
print(db_sorted)
The output is the sorted dictionary. Note that the first dictionary has the smallest salary of Alice and the third dictionary has the largest salary of Alice.
In this example, the dictionary value for the key ‘joined’ was an integer number. But what if it’s a date?
… By Date?
Problem: Given a list of dictionaries. How do you sort the list of dictionaries by date?
Minimal Example: Consider the following example where you want to sort a list of database entries (e.g. each stored as a dictionary) by value of the key 'joined' that is from type date or timedate.
Solution: Define a key function with the lambda keyword. Simply return the string value for the key 'joined' for a given dictionary. This return value is then used to sort the dictionaries in the list.
As the join dates are given as strings in the form year-month-day (e.g. '2020-08-08'), the default alphabetical sort will also lead to a sorted overall list of dictionaries: the dictionary row with the earliest join date will be the first in the resulting list.
Here’s the code:
# Create the dictionary of user entries in your database
db = [{'username': 'Alice', 'joined': '2019-03-02', 'age': 23}, {'username': 'Bob', 'joined': '2020-08-08', 'age': 19}, {'username': 'Alice', 'joined': '2019-03-04', 'age': 31}] # Use the sorted() function with key argument to create a new list.
# Each dictionary list element is "reduced" to the join date.
db_sorted = sorted(db, key=lambda row: row['joined']) # Print everything to the shell
print(db_sorted)
The output is the sorted dictionary. Note that the first dictionary has the earliest and the third dictionary has the latest join date.
You can use a similar method if the dictionary values are of format datetime as they are also comparable with default comparison operators >, <, >=, <=, and ==. [2]
… In Descending Order?
Problem: The default ordering of any Python list sort routine (sorted() and list.sort()) is in ascending order. This also holds if you sort a list of dictionaries. How can you sort in descending order?
Solution: If you want to sort in descending order, you can do one of the following:
Use slicing to reverse the sorted list.
Use the reverse=True argument of the sorted() or list.sort() methods.
Both ways are equivalent. Have a look at the previous example first using the reverse argument:
# Create the dictionary of user entries in your database
db = [{'username': 'Alice', 'joined': '2019-03-02', 'age': 23}, {'username': 'Bob', 'joined': '2020-08-08', 'age': 19}, {'username': 'Alice', 'joined': '2019-03-04', 'age': 31}] # Use the sorted() function with key argument to create a new list.
# Each dictionary list element is "reduced" to the join date.
db_sorted = sorted(db, key=lambda row: row['joined'], reverse=True) # Print everything to the shell
print(db_sorted)
And second using slicing with negative step size (without the reverse argument):
# Create the dictionary of user entries in your database
db = [{'username': 'Alice', 'joined': '2019-03-02', 'age': 23}, {'username': 'Bob', 'joined': '2020-08-08', 'age': 19}, {'username': 'Alice', 'joined': '2019-03-04', 'age': 31}] # Use the sorted() function with key argument to create a new list.
# Each dictionary list element is "reduced" to the join date.
db_sorted = sorted(db, key=lambda row: row['joined'])[::-1] # Print everything to the shell
print(db_sorted)
The default ordering of any Python list sort routine (sorted() and list.sort()) is in ascending order. This also holds if you sort a list of dictionaries.
Where to Go From Here
In this article, you’ve learned how to sort a list of dictionaries. In summary, use the sorted() method with a key function as argument. This gives you the flexibility to customize how exactly you want to sort the dictionary—just map each dictionary to a comparable value.
I’ve realized that professional coders tend to use dictionaries more often than beginners due to their superior understanding of the benefits of dictionaries. If you want to learn about those, check out my in-depth tutorial of Python dictionaries.
If you want to stop learning and start earning with Python, check out my free webinar “How to Become a Python Freelance Developer?”. It’s a great way of starting your thriving coding business online.
Raylib 3.0 was released today. Raylib is an open source, cross platform C based framework of tools and libraries for making games. Components of raylib can be used on their own, however you can also download a preconfigured development environment making it among the easiest ways to get started doing C or C++ game programming.
Details of the 3.0 release:
All global variables from the multiple raylib modules have been moved to a global context state, it has several benefits, first, better code readability with more comprehensive variables naming and categorization (organized by types, i.e. CORE.Window.display.width, CORE.Input.Keyboard.currentKeyState or RLGL.State.modelview). Second, it allows better memory management to load global context state dynamically when required (not at the moment), making it easy to implement a hot-reloading mechanism if desired.
All memory allocations on raylib and its dependencies now use RL_MALLOC, RL_FREE and similar macros. Now users can easely hook their own memory allocations mechanism if desired, having more control on how memory is allocated internally by the library. Additionally, it makes it easier to port the library to embedded devices where memory control is critical. For more info check raylib issue #1074.
All I/O file accesses from raylib are being moved to memory data access, now all I/O file access is centralized into just four functions: LoadFileData(), SaveFileData(), LoadFileText(), SaveFileText(). Users can just update those functions to any I/O file system. This change makes it easier to integrate raylib with Virtual File Systems or custom I/O file implementations.
All raylib data structures have been reviewed and optimized for pass-by-value usage. One of raylib distinctive design decisions is that most of its functions receive and return data by value. This design makes raylib really simple for newcomers, avoiding pointers and allowing complete access to all structures data in a simple way. The downside is that data is copied on stack every function call and that copy could be costly so, all raylib data structures have been optimized to stay under 64 bytes for fast copy and retrieve.
All raylib tracelog messages have been reviewed and categorized for a more comprehensive output information when developing raylib applications, now all display, input, timer, platform, auxiliar libraries, file-accesses, data loading/unloading issues are properly reported with more detailed and visual messages.
raudio module has been internally reviewed to accomodate the new Music structure (converted from previous pointer format) and the module has been adapted to the highly improved miniaudio v0.10.
text module reviewed to improve fonts generation and text management functions, Font structure has been redesigned to better accomodate characters data, decoupling individual characters as Image glyphs from the font atlas parameters. Several improvements have been made to better support Unicode strings with UTF-8 encoding.
Multiple new examples added (most of them contributed by raylib users) and all examples reviewed for correct execution on most of the supported platforms, specially Web and Raspberry Pi. A detailed categorized table has been created on github for easy examples navigation and code access.
New GitHub Actions CI system has been implemented for Windows, Linux and macOS code and examples compilation on every new commit or PR to make sure library keeps stable and usable with no breaking bugs.
The award-winning platformer Gris is out now on Android
April 2, 2020 Gris is now available on Android, and you can find a link to download it at the bottom of this story.
Winner of the Game Awards, ‘Games For Impact’ category, Gris is launching on Android later this week. Following the journey of a girl of the same name, Gris explores ideas of sorrow and grief in a fading world, her dress granting powers which she uses to traverse its many obstacles. Released in December 2018, and launching on iOS at the same time, Gris can be counted as one of the most critically acclaimed indie games of the past couple of years.
In particular, the game was praised for how it dealt with the subject of grief, but also its gorgeous visual aesthetic, and its enchanting soundtrack. Having already cemented its place on mobile with a wonderful iOS port, this Android release has been a long time coming.
Your journey through Gris is somewhat similar to Hellblade (though with far less stabbing of Norse spirits) as you gradually help her recover strength, represented in the powers linked to her dress, and to find acceptance in regards to whatever sorrowful event brought her to this strange plane of existence.
There have been a number of games dealing with mental health in recent years, whether Hellblade, or Sea of Solitude, but with a memorable art style and soundtrack, Gris has carved out some recognition for itself. It was also highly successful considering it was the first game of Barcelona-based developer, Nomada Studio; a collaboration between two ex triple-A developers.
It’s plain to see how inventive Gris is in terms of its gameplay, combining aspects of endless runners, platforming, puzzle, and Metroidvania in terms of abilities. But most of all, the game was recognised for creating a relaxing, therapeutic play experience, mirroring the restorative journey of its protagonist.
If this sounds like your cup of tea, you can grab the Android version right now on Google Play, or purchase the iOS from the App Store for $4.99 (£4.99).
Apple researching trackpad & gesture combo for controlling AR
Rather than attempting to manipulate AR objects through gloves or a game controller, a peripheral like a trackpad could allow users to select and manipulate what they see in front of them.
The four images at the top are meant to be being displayed in AR, while the trackpad-style device at the bottom is a physical one that the user can control
Alongside headsets like Apple Glasses which lets users see augmented reality, there’s a need to interact and manipulate virtual objects. This is often done by the user having to also wear a type of glove, but Apple is looking at creating a physical surface that can detect touch. It’s considering a large trackpad for controlling computer-generated environments (CGR) through ARKit.
“CGR environments are environments where some objects displayed for a user’s viewing are generated by a computer,” says Apple in US Patent No. <a href="http://appft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch-adv.html&r=114&p=3&f=G&l=50&d=PG01&S1=(apple.AANM.+AND+20200402.PD.)&OS=aanm/apple+and+pd/4/2/2020&RS=(AANM/apple+AND+PD/20200402) %0D%0A”>20200104025, called “Remote Touch Detection Enabled by Peripheral Device.”
“A user can interact with these virtual objects by activating hardware buttons or touching touch-enabled hardware,” it continues. “However, such techniques for interacting with virtual objects can be cumbersome and non-intuitive for a user.”
Apple’s proposed solutions include a variety of “techniques for remote touch detection using a system of multiple devices,” but the principle one is a “peripheral device that is placed on a physical surface such as the top of a table.”
While a headset is showing a user a composite image of the real world around him or her, including this trackpad-style device, it can also be displaying virtual objects. Just as with a trackpad and screen on a MacBook Pro, the user can be looking at the virtual object while their fingers perform touch gestures on the trackpad.
A camera in the headset can locate the trackpad, and combined with that device’s touch sensitive surface, calculate what virtual objects the user is attempting to manipulate.
Drawings in the patent show a user selecting from a choice of images by tapping at a corresponding part of the pad. They show the user rotating objects, or resizing them, using familiar touch gestures and movements.
Most of the patent describes methods of registering touches, and of displaying the composite AR and real image. Part of the latter suggests using holograms projected onto surfaces.
Key to the patent application, though, is how the use of the trackpad-like device can change depending on the AR images being presented, and where the device is in relation to the user. The combination of the trackpad and the headset working together mean that the user can be told to reposition the peripheral touch device.
“For optimal operation, peripheral device can request additional space near or around itself such that camera sensor(s) are free from occlusions (e.g., obstructions),” it says. An error message can be displayed in the headset and cleared by the user moving the trackpad into a better position.
The top message is an error displayed on the user’s AR headset, and is cleared by the user moving the trackpad-like device to a better position
That chiefly means being in view of the headset camera and not obscured by other items, but can also be as specific as requiring the device be turned a certain way.
“In some embodiments, the set of operating conditions includes a requirement that peripheral device is in a suitable orientation (e.g., a surface of the peripheral device is approximately parallel with respect to the ground, is horizontal, is vertical, so forth),” it concludes.
The patent is credited to four inventors, Samuel L. Iglesias, Devin W. Chalmers, Rhit Sethi, and Lejing Wang. The latter has recently been credited on a similar patent regarding accurate handling of real and virtual objects, while Chalmers is listed on one about having digital assistants guiding users through AR and VR.
Posted by: xSicKxBot - 04-02-2020, 10:29 AM - Forum: Windows
- No Replies
New Microsoft 365 offerings for small and medium-sized businesses
Today, we announced the Microsoft 365 Personal and Family Subscriptions, the first consumer offerings from Microsoft 365. I’m pleased to follow up here to announce related changes to our Office 365 subscriptions for small and medium-sized businesses—and to Office 365 ProPlus. Going forward, all of these products will use the Microsoft 365 brand.
This is a natural evolution. Microsoft 365 began in 2017 as a licensing bundle for enterprise customers—a combination of Windows, Office, and Enterprise Mobility and Security (EMS). It has come a long way since then. Today, we call it “the world’s productivity cloud” and it represents our vision for the future of Microsoft productivity tools—an integrated set of apps and services that puts artificial intelligence (AI) and other cutting-edge innovations to work for you. And for small and medium-sized businesses, that includes new capabilities in Microsoft Teams to help you host rich meetings and events online; cloud file storage and sharing capabilities so you can collaborate from anywhere; and security and identity solutions to safeguard your business. At a moment when businesses are facing extraordinary health and economic challenges, we are pleased to bring our consumer and small and medium-sized business customers into this growing Microsoft 365 family.
New product names
The new product names go into effect on April 21, 2020. This is a change to the product name only, and there are no pricing or feature changes at this time.
Office 365 Business Essentials will become Microsoft 365 Business Basic.
Office 365 Business Premium will become Microsoft 365 Business Standard.
Microsoft 365 Business will become Microsoft 365 Business Premium.
Office 365 Business and Office 365 ProPlus will both become Microsoft 365 Apps. Where necessary we will use the “for business” and “for enterprise” labels to distinguish between the two.
Note thatthe changes to these products will all happen automatically.
Today, we’re simply announcing name changes. But these changes represent our ambition to continue to drive innovation in Microsoft 365 that goes well beyond what customers traditionally think of as Office. The Office you know and love will still be there, but we’re excited about the new apps and services we’ve added to our subscriptions over the last few years and about the new innovations we’ll be adding in the coming months. For questions, please refer the FAQs below and then head to the What is Microsoft 365 page for more details.
Frequently asked questions
Q. What Office 365 plan names aren’t changing? A. The following Office 365 plans will have no changes:
Office 365 for Enterprise
Office 365 E1
Office 365 E3
Office 365 E5
Office 365 for Firstline Workers
Office 365 F1
Office 365 for Education
Office 365 A1
Office 365 A3
Office 365 A5
Office 365 for Government
Office 365 G1
Office 365 G3
Office 365 G5
Q. Why are you making these changes? A. First, we want our products to reflect the range of features and benefits in the subscription. Microsoft 365 is an integrated set of apps and services that puts AI and other cutting-edge innovations to work for you. And for small and medium-sized businesses, that includes new capabilities in Microsoft Teams to help you host rich meetings and events online; cloud file storage and sharing capabilities so you can collaborate from anywhere; and security and identity solutions to safeguard your businesses. Second, we’re always looking for ways to simplify. This new approach to naming our products is designed to help you quickly find the plan you need and get back to your business.
Q. How does Office fit into Microsoft 365? Will I still be able to use Word, Excel, and PowerPoint? A. The Office suite is core to the Microsoft productivity experience, and that’s not changing. But over the last several years, our cloud productivity offering has grown well beyond what people traditionally think of as “Office.” Word, Excel, and PowerPoint are more important than ever before. But in Microsoft 365 we’re breathing new life into these apps with the help of the cloud and AI, and we’re adding new, born-in-the-cloud experiences like Teams, Stream, Forms, and Planner. All of this is underpinned by a set of common services that keep your data safe and secure. It’s Office and a whole lot more.
Q. Is there anything new or different in Microsoft 365 Apps for business or Microsoft 365 Apps for enterprise plans that wasn’t in Office 365 Business or Office 365 ProPlus plans? Any new features? A. There are no price or feature changes to plans at this time.
Q. When will the Microsoft 365 Business and Microsoft 365 Apps for enterprise plans be available? A. All plans will become available for customers on April 21, 2020.
Q. Are allof the Office 365 plans going away? What isn’t changing? A. None of the plans are going away. The same plans are available, only with updated names. And in the case of Office 365 Enterprise, the name will remain the same and there will be no changes.
Q. I’m an existing SMB or ProPlus customer. Do I need to take any action? A. Customers with the Office 365 Business, Office 365 Business Essentials, Office 365 Business Premium, or Microsoft 365 Business plans do not need to take additional action. The above changes will happen automatically.
Q. My company uses Office 365 ProPlus, and I have questions about this change. Where can I learn more? A. Customers with the Office 365 ProPlus plan should consult this site for further details.
With coronavirus (COVID-19) concerns continuing to mount and social distancing mandates getting extended, the organization behind the annual gaming convention RTX has rescheduled this year's event.
Instead of taking place from July 3-5, entertainment production company Rooster Teeth has moved RTX to Labor Day Weekend: September 5-7. It doesn't seem like any other changes are being made to the convention at the moment, but refunds will be offered to those who change their mind.
Posted by: xSicKxBot - 04-02-2020, 03:38 AM - Forum: Windows
- No Replies
Enabling Remote Work in Response to COVID-19
Technology can play a vital role in reducing the impact of COVID-19 on people and organizations. Across the global economy, we’re helping businesses respond quickly to the challenges of this changing environment, and we’re making sure employees can work remotely without sacrificing collaboration, productivity or security.