Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,946
» Latest member: blackopsdlc
» Forum threads: 22,106
» Forum posts: 23,073

Full Statistics

Online Users
There are currently 1166 online users.
» 1 Member(s) | 1161 Guest(s)
Baidu, Bing, Facebook, Google, SickProdigy

Latest Threads
[Combat Arms] ★★ THE BEST...
Forum: PC Mods
Last Post: xSicKxBot

» Replies: 0
» Views: 0
BO6 Zombies players disap...
Forum: PC Discussion
Last Post: xSicKxBot

» Replies: 0
» Views: 3
[WoW Retail News] Class a...
Forum: World of Warcraft
Last Post: xSicKxBot

» Replies: 0
» Views: 7
Stackable Battery Holders...
Forum: Printers & CAD Projects
Last Post: xSicKxBot

» Replies: 0
» Views: 11
Parts Tray Drawers 3D Pri...
Forum: Printers & CAD Projects
Last Post: xSicKxBot

» Replies: 0
» Views: 11
All In One 3D Printer tes...
Forum: Printers & CAD Projects
Last Post: xSicKxBot

» Replies: 0
» Views: 11
1.75mm Filament Clip 3D P...
Forum: Printers & CAD Projects
Last Post: xSicKxBot

» Replies: 0
» Views: 14
[DevBlog MS] Build Agenti...
Forum: C#, Visual Basic, & .Net Frameworks
Last Post: xSicKxBot

» Replies: 0
» Views: 13
Headphone Stand 3D Print ...
Forum: Printers & CAD Projects
Last Post: xSicKxBot

» Replies: 0
» Views: 12
[Dev News] Gozen – Free &...
Forum: Game Development
Last Post: xSicKxBot

» Replies: 0
» Views: 13

 
  Introducing “Web Live Preview”
Posted by: xSicKxBot - 09-09-2020, 12:48 AM - Forum: C#, Visual Basic, & .Net Frameworks - No Replies

Introducing “Web Live Preview”

Avatar

Tim

If you work on any type of app that has a user interface (UI) you probably have experienced that inner-loop development cycle of making a change, compile and run the app, see the change wasn’t what you wanted, stop debugging, then re-run the cycle again. Depending on the frameworks or technology you use, there are options to improve this experience such as edit-and-continue, Xamarin Hot Reload, and design-time editors. Of course, nothing will show the UI of your app like…well, your app!

For ASP.NET WebForms we have had designers for a while allowing you to switch from your WebForms code view to the Design view to get an idea what the UI may look like. As modern UI frameworks have evolved and relied more on fragments or components of CSS/HTML/etc. this design view may not always reflect the UI:

Screenshot of designer and rendered view of HTML

And these frameworks and UI libraries are becoming more popular and common to a web developer’s experience. We ship them in the box as well with some of our Visual Studio templates! As we looked at some of the web trends and talked with customers in our user research labs we wanted to adapt to that philosophy that the best representation of your UI, data, state, etc. is your actual running app. And so that is what we are working on right now.

Starting today you can download our preview Visual Studio extension for a new editing mode we’re calling “web live preview.” The extension is available now so head on over to the Visual Studio Marketplace and download/install the “Web Live Preview” extension for Visual Studio 2019. Seriously, go do that now and just click install, then come back and read the rest. It will be ready for you when you’re done!

Using the extension


After installing the extension, in an ASP.NET web application you’ll now have an option that says “Edit in Browser” when right-clicking on an ASPX page:

Screenshot of context menu

This will launch your default browser with your app in a special mode. You should immediately notice a small difference in that your view has some adorners on it:

Screenshot of adorners on web page

In this mode you can now interactively select elements on this view and see the selection synchronized with your source. Even if you select something that comes from a master page, the synchronization will open that page in Visual Studio to navigate to the selection.

Animation of element selection

So what you may say, well it’s not just selection synchronization, but source as well. You may have a web control and be selecting those elements and we know that, for example, that is an asp:DataGrid component. As you make changes to the source as well, they are immediately reflected in the running app. Notice no saving or no browser refresh happening:

Animation of changing styles

When working with things like Razor pages, we can detect code as well and even interact within those blocks of code. Here in a Razor page I have a loop. Notice how the selection is identified as a code loop, but I can still make some modifications in the code and see it reflected in the running app:

Animation of changing code

So even in your code blocks within your HTML you can make edits and see them reflected in your running app, shortening that inner loop to smaller changes in your process.

But wait, there’s more!

If you already use browser developer tools you may be asking if this is a full replacement for that for you. And it probably is NOT and that is by design! We know web devs rely a lot on developer tools in browsers and we are experimenting as well with a little extension (for Edge/Chrome) that synchronizes in the rendered dev tools view as well. So now you have synchronization across source representation (including controls/code/static) to rendered app, and with dev tools DOM tree views…and both ways:

Animation of browser tools integration

We have a lot more to do, hence this being a preview of our work so far.

Current constraints


With any preview there are going to be constraints, so here they are for the time of this writing. We eventually see this just being functionality for web developers in Visual Studio without installing anything else, so the extension is temporary. For now, we support the .NET Framework web project types for WebForms and MVC. Yes, we know, we know you want .NET Core and Blazor support. This is definitely on our roadmap, but we wanted to tackle some very known scenarios where our WebForms customers have been using design view for a while. We hear you and this has been echoed in our research as well…we are working on it!

For pure code changes outside of the ASPX/Razor pages we don’t have a full ‘hot reload’ story yet so you will have to refresh the browser in those cases where some fundamental object models are changing that you may rely on (new classes/functions/properties, changed data types, etc.). This is something that we hope to tackle more broadly for the .NET ecosystem and take all that we have learned from customers using similar experiments we have had in this area.

The extension works with Chromium-based browsers such as the latest Microsoft Edge and Google Chrome browsers. This also enables us to have a single browser developer tools extension that handles that integration as well. To use that browser extension, you will have to use developer mode in your browser and load the extension from disk. This process is fairly simple but you have to follow a few steps which are documented on adding and removing extensions in Edge. The location of the dev tools plugin is located at C:\Program Files (x86)\Microsoft Visual Studio\2019\Common7\IDE\Extensions\Microsoft\Web Live Preview\BrowserExtension (assuming you have the default Visual Studio 2019 install location and ensuring you specify Community/Professional/Enterprise you have installed). Please note this is also a temporary solution as we are in development of these capabilities. Any final browser tools extensions would be distributed in browser stores.

Summary


If you are one of our customers that can leverage this preview extension we’d love for you to download and install it and give it a try. If you have feedback or issues, please use the Visual Studio Feedback mechanism as that helps us get diagnostic information for any issues you may be facing. We know that you have a lot of tools at your disposal but we hope this web live preview mode will make some of your flow easier. Nothing to install into your project, no tool-specific code in your source, and (eventually) no additional tools to install. Please give it a try and let us know what you think!

On behalf of the team working on web tools for you, thank you for reading!



https://www.sickgaming.net/blog/2020/06/...e-preview/

Print this item

  Microsoft - New discounts on meeting and calling experiences in Microsoft Teams
Posted by: xSicKxBot - 09-09-2020, 12:47 AM - Forum: Windows - No Replies

New discounts on meeting and calling experiences in Microsoft Teams


Over the past 6 months, organizations around the world have adjusted to remote and hybrid work, pioneering new methods of collaboration, and transforming communication systems to stay connected and productive. By working closely with our customers, we’ve identified key requirements that define how you are using meeting and calling solutions and rethinking your costs to achieve long-term resiliency.

As we’ve shared, your organization’s communication needs likely span a spectrum—from the most basic 1:1 meetings and calls to group meetings to large virtual events and conferences. During the pandemic, organizations transformed rapidly moving meetings online and created hybrid workplaces. This environment confirmed the need for multiple ways to join online meetings. For example, participants who do not have reliable internet access to join Microsoft Teams meetings can use Audio Conferencing to join via a dial-in number. Our customers increasingly need to host large scale virtual events ranging from internal town halls to customer events, and Teams can help with these, too. The new Advanced Communications add-on enables large scale events, but also provides structure and admin control to achieve more professional, seamless, and compliant meeting experiences.

To help our customers enable these scenarios and experience the best of what Microsoft Teams can offer in meetings and voice, we’re announcing new promotional offers that deliver these experiences with significant cost savings.

New Microsoft Teams promotional offers:

  • Get Audio Conferencing for free, available now for Enterprise Agreement customers1 and starting October 1st, 2020 available for customers purchasing via partners and web2.
  • Get 35% off Advanced Communications3, available now for Enterprise Agreement customers, and will be available before the end of the calendar year for customers purchasing via partners and web.
  • For Skype for Business customers, we offer FastTrack support along with great pricing offers to help you move to Teams in a cost-effective manner.  Contact your account representative for more details.

We are committed to helping organizations everywhere stay connected and productive as you navigate new ways of work. By sharing these promotional offers, we aim to support even more of your meeting needs in a cost-efficient manner.

FAQ:

Q: Can an eligible customer use all three offers at once?
A: Yes, if the customer is eligible to all three offers, they can sign up for all three.

Q. Is there a user limit?
A: The offers described above do not have a max number of users.

Q: Are the offers available for education (EDU), GCC, DoD, or GCC High customers?
A: Audio Conferencing Offer1,2: available for GCC and EDU (A3 only) but is not available for DoD and GCC High customers.
Advanced Communication offer3: The offer is not available for EDU customers. Advanced Communications add-on is not yet available to US GOV clouds (DoD, GCC, GCC High).

Q: If I purchase Audio Conferencing via partners or web, how do I enable the offer2?
A: IT Admins can enable it for their organization via the Microsoft 365 Admin Center. First, activate the free Audio Conferencing offer2 to acquire a license and then assign it to a specific user in your tenant.

1 Get Audio Conferencing for free until the end of your enrollment. Eligible for Microsoft Enterprise Agreements customers with paid Microsoft 365 or Office 365 licenses with Microsoft Teams without Audio Conferencing add-on or Microsoft 365 E5. Available now through January 31st, 2021. Available worldwide with the exception in China and India. Talk to your Microsoft sales representative to learn more. The offer is subject to additional terms and conditions.
2 Get Audio Conferencing for free for 12 months. Eligible for CSP and Web Direct customers with paid Microsoft 365 or Office 365 licenses with Microsoft Teams without Audio Conferencing add-on or Microsoft 365 E5. Available Starting October 1st, 2020 through March 31st, 2021. Available worldwide with the exception in China and India. The offer is subject to additional terms and conditions.
3 Get 35% off Advanced Communications until the end of your current subscription terms. Eligible for customers with Microsoft Enterprise Agreements, and paid Microsoft 365 or Office 365 license with Microsoft Teams. Available now through January 31st, 2021. Available worldwide. Broader availability for customers working with our Microsoft partners and transacting on the web is coming soon. The offer is subject to additional terms and conditions.




https://www.sickgaming.net/blog/2020/09/...oft-teams/

Print this item

  News - This Animal Crossing Nook’s Cranny Set Is Being Officially Reviewed By LEGO
Posted by: xSicKxBot - 09-09-2020, 12:47 AM - Forum: Nintendo Discussion - No Replies

This Animal Crossing Nook’s Cranny Set Is Being Officially Reviewed By LEGO


A fan-made LEGO set based on Animal Crossing‘s Nook’s Cranny shop is being officially reviewed by the company as part of its LEGO Ideas campaign.

As you may be aware, the LEGO Ideas website allows fans to submit their very own designs for approval. If a design gets 10,000 votes from the community, it’s automatically put forward for review by LEGO and can end up being a real product found on store shelves–the designer can enjoy 1% of the royalties, too.

The Nook’s Cranny design, inspired by the store’s appearance in Animal Crossing: New Horizons on Switch, is one of a whopping 35 Ideas that have made it through for review. Both the inside and outside are fully kitted out, and there’s even a Villager Minifigure sporting the classic ‘number 1’ t-shirt.

“As a fan of Animal Crossing, I have wanted to do a build from the game,” says the design’s creator, Micro_Model_Maker. “I have seen a lot of house builds from the game so I have decided to do Nook’s Cranny to shake things up a bit. The build features an interior; I tried to get it as close to the game as possible but due to size I have had to move some things around, however I believe it captures the spirit”.


The creator also wants to include Timmy and Tommy Minifigures, but didn’t have the parts needed. They say that new moulds might be required to pull that off.

As it happens, plenty of video game designs are making it through LEGO Ideas this year. A few months ago, sets based on The Legend of Zelda, Sonic, and Untitled Goose Game also passed the test and are currently under review.

We’d love to see these hit the market, but it’s important to remember that reaching this stage doesn’t guarantee success. LEGO and Nintendo may well have a pretty great relationship these days, but sets like this would still need to be approved by the Big N, too.

Would you snap one of these up given the chance? Let us know in the comments.



https://www.sickgaming.net/blog/2020/09/...d-by-lego/

Print this item

  News - You Can Preorder A $10K Gold PS5 This Week
Posted by: xSicKxBot - 09-08-2020, 08:15 PM - Forum: Lounge - No Replies

You Can Preorder A $10K Gold PS5 This Week

Let's be honest: the design of the upcoming PS5 is divisive, to say the least. It's huge, it's white, and it looks a little bit like a device that would digitize your soul in a bad sci-fi movie. That said, if you'd prefer a more luxurious design, you'll get your chance later this week.

The previously-announced gold PS5 will soon be available for preorder from a third-party UK retailer, and the price tag is a whopping £7999 for the 18K rose-gold version and £8099 for the 24K gold version. (That's around $10,500, if you're wondering.) If you just want a part of the look, you can nab a gold PS5 controller for £649 and a headset for £399. Preorders will start on Thursday, September 10.

For the rest of us plebs who can't afford a solid-gold console, we still don't know how much the PS5 is going to retail for, or even a specific release date beyond holiday 2020. The smaller Xbox Series S was confirmed for a $299 price point earlier today, but we still don't know the price of the flagship Xbox Series X, though credible reports have suggested $499. Sony also confirmed that the PS5 will be backward-compatible with PS4 games, though it will not be able to play games from previous generations beyond that. At least we're getting that Demon's Souls remake, so I can stop lugging my PS3 out of storage for that. If you want to preorder a regular PS5, you can sign up on Sony's website. Given that supplies are going to be limited, you should act fast.

Continue Reading at GameSpot

https://www.gamespot.com/articles/you-ca...01-10abi2f

Print this item

  ASP.NET Core updates in .NET 5 Preview 5
Posted by: xSicKxBot - 09-08-2020, 06:30 PM - Forum: C#, Visual Basic, & .Net Frameworks - No Replies

ASP.NET Core updates in .NET 5 Preview 5

Avatar

Sourabh

.NET 5 Preview 5 is now available and is ready for evaluation! .NET 5 will be a current release.

Get started


To get started with ASP.NET Core in .NET 5.0 Preview5 install the .NET 5.0 SDK.

If you’re on Windows using Visual Studio, we recommend installing the latest preview of Visual Studio 2019 16.7.

If you’re on macOS, we recommend installing the latest preview of Visual Studio 2019 for Mac 8.7.

Upgrade an existing project


To upgrade an existing ASP.NET Core 5.0 preview4 app to ASP.NET Core 5.0 preview5:

  • Update all Microsoft.AspNetCore.* package references to 5.0.0-preview.5.*.
  • Update all Microsoft.Extensions.* package references to 5.0.0-preview.5.*.

See the full list of breaking changes in ASP.NET Core 5.0.

That’s it! You should now be all set to use .NET 5 Preview 5.

What’s new?


Reloadable endpoints via configuration for Kestrel


Kestrel now has the ability to observe changes to configuration passed to KestrelServerOptions.Configure and unbind from existing endpoints and bind to new endpoints without requiring you to restart your application.

See the release notes for additional details and known issues.

Give feedback


We hope you enjoy this release of ASP.NET Core in .NET 5! We are eager to hear about your experiences with this latest .NET 5 release. Let us know what you think by filing issues on GitHub.

Thanks for trying out ASP.NET Core!



https://www.sickgaming.net/blog/2020/06/...preview-5/

Print this item

  Microsoft - New life for old computers helps students in need learn from home
Posted by: xSicKxBot - 09-08-2020, 06:30 PM - Forum: Windows - No Replies

New life for old computers helps students in need learn from home

The COVID-19 pandemic has forced many school students around the world to embrace remote learning. But not all have computers at home.

Now a group of companies and non-profits in Hong Kong are taking part in a global program by Microsoft that breathes new life into old office PCs and distributes them to students from disadvantaged backgrounds.

“I live in a village in Sha Tin, and my family’s income is limited,” says Wu Jiahui, a Secondary 5 (Year 11) student at Toi Shan Association College. “We don’t have the ability to purchase computers.”

Instead, Jiahui has had to rely on her smartphone to study. “But the speed is slower, and the software is not sufficient,” she says. “Because of the small screen, it’s hard to read, and the long-term use of my mobile phone caused shoulder pain and dry eye syndrome.”

Without a proper device, students can’t learn efficiently. The quality of their work and their health can be seriously affected. 


– Albert Wong, Association of IT Leaders in Education

Before the COVID-19 lockdowns, Jiahui would finish her homework in her school’s computer room at the end of each day’s lessons. “But I couldn’t make any revisions to my homework at home.”

Barriers to learning

Albert Wong, chairman of the Association of IT Leaders in Education (AiTLE), says students without a computer at home usually end up using their smartphones. “But mobile devices are made for communication, not for learning,” he says.

“Some learning websites have layouts that are not optimal for mobile devices, making it difficult for students to watch video lessons or view slides. Formatting text and visuals for school projects on a smartphone can also be arduous. Not having their own computers hinders students’ creativity and makes learning time-consuming.”

A woman wearing a face mask moves a box from the back of a van.
Crossroads Foundation volunteer Joanne de la Zilwa helps unload donated devices.

Wong says computers have become essential for learning during the COVID-19 pandemic. “With school suspensions lasting for months due to the pandemic, online learning activities, such as webinars and virtual projects, are necessary,” he says. “Without proper devices, students can’t learn efficiently. The quality of their work and their health can be seriously affected.”

A recent survey of almost 600 students in the territory found that over 70% either don’t have computers or have outdated machines, while 51% don’t have a desk for studying. Moreover, 83% of students said these hurdles made them worry about falling behind their peers.

Empowering students in need

Recognizing this challenge, Microsoft has partnered with corporate groups, computer refurbishers, and education associations to provide computers – once used in offices – to students in need.

“Not every family is in a financial position to provide their children with a computer. Remote learning makes this situation especially hard,” says Ada Ng, Microsoft Hong Kong’s director of corporate affairs and philanthropies. “Donating refurbished hardware is a great way to make a positive impact on a student’s day-to-day life.”

Volunteers at the non-profit Crossroads Foundation overhaul donated PCs under Microsoft’s Refurbisher Program — through which authorized refurbishers across the globe collect secondhand devices, fix them up, and preinstall genuine Microsoft software.

In one recent two-month effort, more than 1,000 used desktops and laptops machines were serviced and refitted, and then sent out to needy students.



https://www.sickgaming.net/blog/2020/09/...from-home/

Print this item

  News - Super Rare Games Has An Exciting Week In Store For Physical Switch Collectors
Posted by: xSicKxBot - 09-08-2020, 06:30 PM - Forum: Nintendo Discussion - No Replies

Super Rare Games Has An Exciting Week In Store For Physical Switch Collectors


Super Rare GamesSuper Rare Games / Nintendo Life

Super Rare Games, one of several companies fighting to keep the world of physical games alive and well, is kicking off a bumper week of deals, competitions, and reveals.

Perhaps the most exciting news for physical collectors is confirmation that the publisher’s next physical Switch game will be revealed tomorrow, Wednesday 9th September. It sounds like it’ll be a crowd-pleaser, too; the press release says, “if our Twitter mentions are anything to go by, it’s one you’ve been waiting for”.

On top of this, Super Rare Games promises “deals, competitions, teases, and some other small surprises” throughout the week, and it’ll also be sharing its plans for the rest of 2020–including info on how many more games will be released and the Collector’s Editions you can expect to look out for. Make sure to keep an eye on its social media channels.

So, those deals we mentioned? Get a load of this:

FREE SHIPPING on any order that includes The Gardens Between: Collector’s Edition or Smoke & Sacrifice! (Excludes orders that contain Dandara)

Two Tribes Collection has been added back to the store! Only 23 copies have been put on sale from units previously held for customer service

50% off all t-shirts – only 100 of each design printed. Once they’re gone, they’re gone

25% off trading card binders – protect, organise, and display your Super Rare card collection

Taking advantage of that shipping discount? Chroma Squad, Old School Musical, SteamWorld Heist, and Little Inferno have limited stock remaining

All of these offers are set to end on 13th September, or when stock runs out, of course. You can buy all of these games and browse the Super Rare store right here.

Super Rare Games

Do you collect physical indie games? How many do you have in your collection? Let us know with a comment.



https://www.sickgaming.net/blog/2020/09/...ollectors/

Print this item

  [Tut] Python One Line Sum List
Posted by: xSicKxBot - 09-08-2020, 03:43 PM - Forum: Python - No Replies

Python One Line Sum List

Article summary: Here’s a quick visual overview of the contents of this tutorial.

How to sum over all values in a given Python list?

  • Flat List: To sum over a list of numbers in a single line of Python code, use Python’s built-in function sum(list).
  • Nested List: To sum over a list of lists in one line Python, use a generator expression to flatten the list and pass the result into the function: sum(x for y in list for x in y).

Method 1: Sum over a Flat List in One Line


Problem: How to sum over all values in a given Python list?

Example: Given the following list.

a = [1, 2, 3]

You want to calculate the sum of all values in the list—using only a single line of Python code!

# RESULT: 6

Solution: Python’s built-in sum() function helps you to sum over all values in an iterable, such as a Python list.

Summing up a list of numbers appears everywhere in coding. Fortunately, Python provides the built-in sum() function to sum over all elements in a Python list—or any other iterable for that matter. (Official Docs)

Code: Here’s the minimal code example.

a = [1, 2, 3] print(sum(a))
# 6

How does it work? The syntax is sum(iterable, start=0):


Argument Description
iterable Sum over all elements in the iterable. This can be a list, a tuple, a set, or any other data structure that allows you to iterate over the elements.
Example: sum([1, 2, 3]) returns 1+2+3=6.
start (Optional.) The default start value is 0. If you define another start value, the sum of all values in the iterable will be added to this start value.
Example: sum([1, 2, 3], 9) returns 9+1+2+3=15.



Exercise: Try to modify the sequence so that the sum is 30 in our interactive Python shell:

Method 2: Sum over a Nested List of Lists in One Line


Problem: Given multiple lists in a list of lists. How can you sum over all values in a list of lists such as [[1, 2], [3, 4], [5, 6]] in Python?

Solution: Use a generator expression to flatten the values in the nested list and pass the resulting iterable into the sum() function.

Code: The following code creates a list of lists:

a = [[1, 2], [3, 4], [5, 6]]

To sum over the values in the list of lists, use the following one-liner:

print(sum(x for y in a for x in y))

The output is printed on the shell:

# OUTPUT: 21

But how does it work? The main part of the code is the generator expression x for y in a for x in y that flattens the list.

  • The part x for y in a for x in y iterates over all elements y in the nested list a.
  • The part x for y in a for x in y iterates over all elements y in the inner list y.
  • The part x for y in a for x in y stores the inner element in the iterable.

Here’s a recap on the technique of list comprehension.



To learn more about different ways to sum() elements in a list, check out my detailed blog tutorial:

Related Tutorial: Python sum() List — Ultimate Guide

Python One-Liners Book


Python programmers will improve their computer science skills with these useful one-liners.

Python One-Liners

Python One-Liners will teach you how to read and write “one-liners”: concise statements of useful functionality packed into a single line of code. You’ll learn how to systematically unpack and understand any line of Python code, and write eloquent, powerfully compressed Python like an expert.

The book’s five chapters cover tips and tricks, regular expressions, machine learning, core data science topics, and useful algorithms. Detailed explanations of one-liners introduce key computer science concepts and boost your coding and analytical skills. You’ll learn about advanced Python features such as list comprehension, slicing, lambda functions, regular expressions, map and reduce functions, and slice assignments. You’ll also learn how to:

•  Leverage data structures to solve real-world problems, like using Boolean indexing to find cities with above-average pollution
•  Use NumPy basics such as array, shape, axis, type, broadcasting, advanced indexing, slicing, sorting, searching, aggregating, and statistics
•  Calculate basic statistics of multidimensional data arrays and the K-Means algorithms for unsupervised learning
•  Create more advanced regular expressions using grouping and named groups, negative lookaheads, escaped characters, whitespaces, character sets (and negative characters sets), and greedy/nongreedy operators
•  Understand a wide range of computer science topics, including anagrams, palindromes, supersets, permutations, factorials, prime numbers, Fibonacci numbers, obfuscation, searching, and algorithmic sorting

By the end of the book, you’ll know how to write Python at its most refined, and create concise, beautiful pieces of “Python art” in merely a single line.

Get your Python One-Liners Now!!



https://www.sickgaming.net/blog/2020/09/...-sum-list/

Print this item

  [Tut] Image Editor: Move Scale Skew Rotate and Spin with CSS Transform
Posted by: xSicKxBot - 09-08-2020, 03:43 PM - Forum: PHP Development - No Replies

Image Editor: Move Scale Skew Rotate and Spin with CSS Transform

Last modified on July 22nd, 2020.

Are you interested in creating an image editor tool? If so, this article will help you to get started with it.

An image editor will have a range of tools. It can be very basic with only tools like resize, rotate and crop. Or it can be super extensive like a Photoshop.

Rotate is a basic and essential tool that is part of any image editor. Let us start with something easy and basic like rotate then add some more essential tools.

I will be using CSS transform property as the core and add JavaScript to enrich the tool.

This can become a basic starter toolkit that can be expanded to a full fledged image editor in the future.

Following is a preview of the things to come.

What is inside?


  1. How to edit an image?
  2. A quick glance on CSS transform and image editing
  3. Examples and demo on image editing
  4. Conditions and exceptions on applying transform property
  5. Importance of respecting system preferences

How to edit an image?


Do not underestimate the power of CSS. Gone or those days, where CSS just applies decoration on top of HTML and beautifies the document. CSS3 and beyond, with the combined support of HTML5, advancements in the browser support has change CSS to a powerful UI tool.

It complements well with the JavaScript. When we combine it together, we can create wonders. The divide between thin-client and thick-client has vanished. The CSS is a very good beginner’s tool to start with simple image editor features.

When you work on image editing capabilities with CSS, you must consider browser compatibility. Some browsers will not render as you code. So, we have to be carefully choosing the properties.

I have used CSS keyframesrules to set the core properties.

In an older article, we have see several animation effects with CSS and Javascript.

In this article, you can find the example code of the below items with a demo.

  • Rotation and spin
  • Skew
  • Scale
  • Translation

A quick glance on CSS transform and image editing


CSS transform property can be used to do basic image editing. It supports functions like rotation, skew, scale and translate.

The key functions are rotate(), skew(), scale(), translate().

The transform functions have classification based on the axis of animation. For example rotateX(), rotateY() and more. This can be used for image animation.

We can apply the transform functions in a combination way for a single UI element’s selector. When we use many transform function, the animation effects happen in a right to left order.

Examples and demo on image editing


Scaling an image


The scaling is a transform function that allows us to scale up or down the element’s dimension. The scaling transform output varies based on the function used and its parameters.

The scale() function can have single or dual parameters. With a single parameter, it applies uniform scaling in both x, y-axis. When we supply separate values for the x, y-axis, then the scaling range will vary.

With three params the scale3d() function allows scaling in x,y,z axis.

We can also apply scaling with respect to single axis by using scaleX(), scaleY() or scaleZ().

The above demo has a slider to scale up and down an image.

Below code has the UI elements to apply scaling transform on an image element. It has a pallet with an image element and animation tools.

image-scale/index.php

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../assets/css/phppot-style.css" type="text/css" rel="stylesheet" />
<link href="./assets/css/style.css" type="text/css" rel="stylesheet" />
<link href="../vendor/jquery/ui/jquery-ui.min.css" type="text/css" rel="stylesheet" />
<script src='../vendor/jquery/jquery-3.3.1.js' type='text/javascript'></script>
<script src='../vendor/jquery/ui/jquery-ui.min.js' type='text/javascript'></script>
</head> <body> <div class="phppot-container"> <div class="container"> <div class="image-demo-box"> <div id="slider"> <div id="scale-handle" class="ui-slider-handle"></div> </div> <img src='../sweet.jpg' id='image' /> </div> </div> </div> <script src='./assets/js/scale.js'></script>
</body>
</html>

This jQuery script initiates UI slider by setting the min max ranges. The slider handle will show the scaling factor.

On dragging the slider, the script applies scaling transform on the image element. The slider’s step property defines the scaling multiples.

On dragging the slider handle, the script will populate the scaling factor in the handle.

image-scale/assets/js/scale.js

$(document).ready(function() { var scaleX = 2; var handle = $("#scale-handle"); $("#slider").slider({ min : 1, max : 2.5, value: scaleX, step: 0.1, create : function() { handle.text(scaleX+"x"); scale(scaleX); }, slide : function(event, ui) { scaleX = ui.value; handle.text(scaleX + "x"); scale(scaleX); } });
}); function scale(scaleX) { $('#image').css('transform', 'scale(' + scaleX + ')');
}

Translating image element


Like other transform functionality, the translate() function performs 2D, 3D translation.

The translate() function with one or two params results in 2D translation. The two params are to move the image in the x, y-axis of a 2D plane. With single param, the translate() will happen in a horizontal direction.

The translateX() and translateY() are for implementing translation in a particular direction.

The translate3d() with x, y, z factors allows creating 3D animation.

In this demo, there are two sliders in horizontal and vertical directions. On dragging the handle of these sliders, it moves the image on the 2D plane shown above.

This HTML shows the template elements to set the image-translate demo.

image-translate/index.php

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../assets/css/phppot-style.css" type="text/css" rel="stylesheet" />
<link href="./assets/css/style.css" type="text/css" rel="stylesheet" />
<link href="../vendor/jquery/ui/jquery-ui.min.css" type="text/css" rel="stylesheet" />
<script src='../vendor/jquery/jquery-3.3.1.js' type='text/javascript'></script>
<script src='../vendor/jquery/ui/jquery-ui.min.js' type='text/javascript'></script>
</head> <body> <div class="phppot-container"> <div class="container"> <div class="image-demo-box"> <div id="slider"> <div id="translate-x" class="ui-slider-handle"></div> </div> <div id="v-slider"> <div id="translate-y" class="ui-slider-handle"></div> </div> <img src='../sweet.jpg' id='image' /> </div> </div> </div> <script src='./assets/js/translate.js'></script>
</body>
</html>

This script sets the horizontal and vertical translation slider properties. The horizontal slider has the range between o -160. And, the vertical translation ranges between  0 to 50.

image-translate/assets/js/translate.js

$(document).ready(function() { var translateX; var handle = $("#translate-x"); $("#slider").slider({ range : "min", min : 0, max : 160, create : function() { handle.text($(this).slider("value") + " px"); }, slide : function(event, ui) { translateX = ui.value; handle.text(translateX + " px"); translate(translateX); } }); var translateY; var vhandle = $("#translate-y"); $("#v-slider").slider({ range : "min", min : 0, max : 50, orientation : "vertical", create : function() { vhandle.text($(this).slider("value") + " px"); }, slide : function(event, ui) { translateY = ui.value; vhandle.text(translateY + " px"); translatey(translateY); } }); }); function translate(translateX) { $('#image').css('transform', 'translateX(' + translateX + 'px)');
} function translatey(translateY) { $('#image').css('transform', 'translateY(' + translateY + 'px)');
}

Tools for rotating an image


Ah yes, we have reached the rotate tool. This is a core feature in any image editor. Rotation spins the image or other UI elements based on the angle specified.

With a negative degree, the animation will happen in counter-clockwise rotation.

Like scale and translate, rotate function also has classification based on the axis. Those are,

  • rotate(angle)
  • rotate3d(x, y, z, angle)
  • rotateX(angle)
  • rotateY(angle)
  • rotateZ(angle)

The rotate3d() function needs the angle and the x, y, z co-ordinates of the rotation axis.

A spin will make the image rotate from 0 to 360 degrees. You can stop spinning or refresh the image orientation back to its original.

image-rorate/index.php

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../assets/css/phppot-style.css" type="text/css" rel="stylesheet" />
<link href="./assets/css/style.css" type="text/css" rel="stylesheet" />
<link href="../vendor/jquery/ui/jquery-ui.min.css" type="text/css" rel="stylesheet" />
<script src='../vendor/jquery/jquery-3.3.1.js' type='text/javascript'></script>
<script src='../vendor/jquery/ui/jquery-ui.min.js' type='text/javascript'></script>
</head> <body> <div class="phppot-container"> <div class="container"> <input type='text' id='txtInputAngle' class="degree" value="10" /> <input type='button' id='btnRotate' value='Rotate' /> <input type='button' id='btnSpin' value='Spin' data-state='off' /> <input type='button' id='btnRefresh' value='Refresh' /> <div class="image-demo-box"> <div id="slider"> <div id="rotation-angle" class="ui-slider-handle"></div> </div> <img src='../sweet.jpg' id='image' /> </div> </div> </div> <script src='./assets/js/rotate.js'></script>
</body>
</html>

I have used CSS keyframes to allow continuous spinning. Below CSS shows the styles used for the image rotation demo.

image-rorate/assets/css/style.css

.image-demo-box { border: #CCC 1px solid; text-align: center; margin: 15px 0px; } input[type=button] { width: 65px; margin-right: 8px; outline: none; background: #f6f5f6;
} input.degree
{ width: 50px;
} #image { margin: 50px auto; border: #f6f5f6 10px solid; width: 200px;
}
.rotate { animation: rotation 8s infinite linear;
} div#slider { border-bottom: 1px solid #c5c5c5;
} #slider .ui-slider-range { background: #c5c5c5; } #rotation-angle { width: 50px; padding: 3px 5px 1px 5px; font-size: 0.8em; text-align: center; border-radius: 2px; outline: none; } .ui-slider-handle.ui-corner-all.ui-state-default { border: 1px solid #c5c5c5; background: #f6f6f6; font-weight: normal; color: #454545;
} @keyframes rotation { from { transform: rotate(0deg); } to { transform: rotate(359deg); }
}

When you click the rotation tool, a jQuery script rotates the image based on the specified angle.

It changes the images’ transform property using jQuery $.css() function.

The rotation slider ranges from 0 to 360 degrees. I have added the rotation script below. It shows how to turn on a jQuery UI slider to rotate an image element.

image-rorate/assets/js/rotate.js

$(document).ready(function() { var rotationAngle; var handle = $("#rotation-angle"); $("#slider").slider({ range : "min", min : 0, max : 360, create : function() { handle.text($(this).slider("value") + " deg"); }, slide : function(event, ui) { $('#image').removeClass('rotate'); rotationAngle = ui.value; handle.text(rotationAngle + " deg"); rotate(rotationAngle); } }); $('#btnSpin').on('click', function() { if ($(this).data('state') == 'off') { spin($(this)); } else { stopSpin($(this)); } }); $('#btnRotate').on('click', function() { $('#image').removeClass('rotate'); rotationAngle = $('#txtInputAngle').val(); rotate(rotationAngle); }); $('#btnRefresh').on('click', function() { $('#image').removeClass('rotate'); rotate(0); });
}); function spin(buttonElement) { $('#image').addClass('rotate'); $("#image").css("animation-play-state", "running"); $(buttonElement).data('state', 'on'); $(buttonElement).val('Stop');
} function stopSpin(buttonElement) { $("#image").css("animation-play-state", "paused"); $(buttonElement).data('state', 'off'); $(buttonElement).val('Spin');
} function rotate(rotationAngle) { if ($('#btnSpin').data('state') == 'on') { stopSpin($('#btnSpin')); } $('#image').css('transform', 'rotate(' + rotationAngle + 'deg)');
}

Apply skew transform


By changing each point of the element in a fixed direction will skew the element. This change will tilt or skews the elements layout based on the specified angle.

The skew transform functions skewX(), skewY(), skewZ() tilting element boxes along with the X, Y, Z axis.

image-skew/index.php

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../assets/css/phppot-style.css" type="text/css" rel="stylesheet" />
<link href="./assets/css/style.css" type="text/css" rel="stylesheet" />
<link href="../vendor/jquery/ui/jquery-ui.min.css" type="text/css" rel="stylesheet" />
<script src='../vendor/jquery/jquery-3.3.1.js' type='text/javascript'></script>
<script src='../vendor/jquery/ui/jquery-ui.min.js' type='text/javascript'></script>
</head> <body> <div class="phppot-container"> <div class="container"> <div class="image-demo-box"> <div id="slider"> <div id="skew-angle" class="ui-slider-handle"></div> </div> <img src='../sweet.jpg' id='image' /> </div> </div> </div> <script src='./assets/js/skew.js'></script>
</body>
</html>

image-skew/assets/js/skew.js

$(document).ready(function() { var skewAngle; var handle = $("#skew-angle"); $("#slider").slider({ range : "min", min : 0, max : 40, create : function() { handle.text($(this).slider("value") + " deg"); }, slide : function(event, ui) { skewAngle = ui.value; handle.text(skewAngle + " deg"); skew(skewAngle); } }); });
function skew(skewAngle) { $('#image').css('transform', 'skew(' + skewAngle + 'deg)'); }

Conditions and exceptions on applying transform property


The CSS transform property will not work with some UI elements.

For example, table column element <col>, table column group element <col-group>, and more. Those are non-transformable elements.

What are transformable elements?

Most of the UI elements enclosed with the CSS box model are transformable. The following image shows the HTML element layout enclosed by a CSS box model.

CSS Box Model

Also, renderable graphical elements, clipPath elements are also known as a transformable element.

Importance of respecting system preferences


The system preferences will affect the motion of elements. If your system preferences is set to reduce animation is on, it will omit the animation effect of the above demo.

To respect this settings we have to add a CSS media rule to set the
prefers-reduced-motion. The possible values are no-preferences and reduce.

This media rule with reduce option provides a CSS block to suppress animation.

@media (prefers-reduced-motion: reduce) { .rotate { transform: none; }
}

In the above examples, I have used the media rule to respect the user’s system preferences. You can test this with the demo by enabling the reduced-motion.

System Preferences to Reduce Animation

Conclusion


We have seen the CSS transform based image editing. This is just a beginning only. This can serve as a bootstrap for building a full fledged image editor.

With CSS transform, we have added JavaScript and enriched the tool. We have also added various motion effects.

I have added most of the template files and the jQuery scripts above. But you can find the complete bundle with the downloadable source code here below.

Download

↑ Back to Top



https://www.sickgaming.net/blog/2020/07/...transform/

Print this item

  (Indie Deal) Metro Exodus Historical Deal, The Survivalists & Little Hope
Posted by: xSicKxBot - 09-08-2020, 03:43 PM - Forum: Deals or Specials - No Replies

Metro Exodus Historical Deal, The Survivalists & Little Hope

Metro Exodus at 58% OFF for Steam
[www.indiegala.com]
Explore the Russian wilderness at a new historical low price

NEW Pre-Opportunities
https://youtu.be/QjKq16H2jc8
The Dark Pictures Anthology: Little Hope[www.indiegala.com]
https://youtu.be/Sb2X7BhDXh4
The Survivalists[www.indiegala.com]

Bundle Round-up

Stay Inside, Stay Safe and Enjoy Good Games.
Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...1191469579

Print this item