Rupert  Beatty

Rupert Beatty

1667103240

Pageboy: A Simple, Highly informative Page View Controller

Pageboy

TL;DR UIPageViewController done properly.

⭐️ Features

  •  Simplified data source management & enhanced delegation.
  •  Dynamically insert & remove pages.
  •  Infinite scrolling support.
  •  Automatic timer-based page transitioning.
  •  Support for custom animated page transitions.

📋 Requirements

Pageboy requires iOS 9 / tvOS 10; and is compatible with Swift 5.

📲 Installation

Swift Package Manager

Pageboy is compatible with Swift Package Manager and can be integrated via Xcode.

CocoaPods

Pageboy is also available through CocoaPods:

pod 'Pageboy', '~> 3.7'

Carthage

Pageboy is also available through Carthage:

github "uias/Pageboy" ~> 3.7

🚀 Usage

The Basics

Create an instance of a PageboyViewController and provide it with a PageboyViewControllerDataSource.

class PageViewController: PageboyViewController, PageboyViewControllerDataSource {

    override func viewDidLoad() {
        super.viewDidLoad()
        
    self.dataSource = self
    }
}

Implement the PageboyViewControllerDataSource functions.

func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
    return viewControllers.count
}

func viewController(for pageboyViewController: PageboyViewController,
                    at index: PageboyViewController.PageIndex) -> UIViewController? {
    return viewControllers[index]
}

func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
    return nil
}

PageboyViewControllerDelegate

The delegate functions provided by a PageboyViewController are much more reliable and useful than what a raw UIPageViewController provides. You can use them to find out exactly where the current page is, and when it's moved, where it's headed.

willScrollToPageAtIndex

About to embark on a transition to a new page.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           willScrollToPageAt index: Int,
                           direction: PageboyViewController.NavigationDirection,
                           animated: Bool)

didScrollToPosition

Scrolled to a relative position along the way transitioning to a new page.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           didScrollTo position: CGPoint,
                           direction: PageboyViewController.NavigationDirection,
                           animated: Bool)

didScrollToPage

Successfully completed a scroll transition to a page.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           didScrollToPageAt index: Int,
                           direction: PageboyViewController.NavigationDirection,
                           animated: Bool)

didReload

Child view controllers have been reloaded.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           didReloadWith currentViewController: UIViewController,
                           currentPageIndex: PageIndex)

Navigation

You can navigate programmatically through a PageboyViewController using scrollToPage():

pageViewController.scrollToPage(.next, animated: true)
  • Infinite scrolling can be enabled with .isInfiniteScrollEnabled.
  • Interactive scrolling can also be controlled with .isScrollEnabled.

Insertion & Deletion

Pageboy provides the ability to insert and delete pages dynamically in the PageboyViewController.

func insertPage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
func deletePage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)

This behaves similarly to the insertion of rows in UITableView, in the fact that you have to update the data source prior to calling any of the update functions.

Example:

let index = 2
viewControllers.insert(UIViewController(), at: index)
pageViewController.insertPage(at: index)

The default behavior after inserting or deleting a page is to scroll to the update location, this however can be configured by passing a PageUpdateBehavior value other than .scrollToUpdate.

⚡️ Other Extras

  • reloadData() - Reload the view controllers in the page view controller. (Reloads the data source).
  • .navigationOrientation - Whether to orientate the pages horizontally or vertically.
  • .currentViewController - The currently visible view controller if it exists.
  • .currentPosition - The exact current relative position of the page view controller.
  • .currentIndex - The index of the currently visible page.
  • .parentPageboy - Access the immediate parent PageboyViewController from any child view controller.

Animated Transitions

Pageboy also provides custom transition support for animated transitions. This can be customized via the .transition property on PageboyViewController.

pageboyViewController.transition = Transition(style: .push, duration: 1.0)

Note: By default this is set to nil, which uses the standard animation provided by UIPageViewController.

Auto Scrolling

PageboyAutoScroller is available to set up timer based automatic scrolling of the PageboyViewController:

pageboyViewController.autoScroller.enable()

Support for custom intermission duration and other scroll behaviors is also available.

👨🏻‍💻 About

❤️ Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/uias/Pageboy.

Download Details:

Author: uias
Source Code: https://github.com/uias/Pageboy 
License: MIT license

#swift #pages #ios #view 

What is GEEK

Buddha Community

Pageboy: A Simple, Highly informative Page View Controller
Rupert  Beatty

Rupert Beatty

1667103240

Pageboy: A Simple, Highly informative Page View Controller

Pageboy

TL;DR UIPageViewController done properly.

⭐️ Features

  •  Simplified data source management & enhanced delegation.
  •  Dynamically insert & remove pages.
  •  Infinite scrolling support.
  •  Automatic timer-based page transitioning.
  •  Support for custom animated page transitions.

📋 Requirements

Pageboy requires iOS 9 / tvOS 10; and is compatible with Swift 5.

📲 Installation

Swift Package Manager

Pageboy is compatible with Swift Package Manager and can be integrated via Xcode.

CocoaPods

Pageboy is also available through CocoaPods:

pod 'Pageboy', '~> 3.7'

Carthage

Pageboy is also available through Carthage:

github "uias/Pageboy" ~> 3.7

🚀 Usage

The Basics

Create an instance of a PageboyViewController and provide it with a PageboyViewControllerDataSource.

class PageViewController: PageboyViewController, PageboyViewControllerDataSource {

    override func viewDidLoad() {
        super.viewDidLoad()
        
    self.dataSource = self
    }
}

Implement the PageboyViewControllerDataSource functions.

func numberOfViewControllers(in pageboyViewController: PageboyViewController) -> Int {
    return viewControllers.count
}

func viewController(for pageboyViewController: PageboyViewController,
                    at index: PageboyViewController.PageIndex) -> UIViewController? {
    return viewControllers[index]
}

func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
    return nil
}

PageboyViewControllerDelegate

The delegate functions provided by a PageboyViewController are much more reliable and useful than what a raw UIPageViewController provides. You can use them to find out exactly where the current page is, and when it's moved, where it's headed.

willScrollToPageAtIndex

About to embark on a transition to a new page.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           willScrollToPageAt index: Int,
                           direction: PageboyViewController.NavigationDirection,
                           animated: Bool)

didScrollToPosition

Scrolled to a relative position along the way transitioning to a new page.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           didScrollTo position: CGPoint,
                           direction: PageboyViewController.NavigationDirection,
                           animated: Bool)

didScrollToPage

Successfully completed a scroll transition to a page.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           didScrollToPageAt index: Int,
                           direction: PageboyViewController.NavigationDirection,
                           animated: Bool)

didReload

Child view controllers have been reloaded.

func pageboyViewController(_ pageboyViewController: PageboyViewController,
                           didReloadWith currentViewController: UIViewController,
                           currentPageIndex: PageIndex)

Navigation

You can navigate programmatically through a PageboyViewController using scrollToPage():

pageViewController.scrollToPage(.next, animated: true)
  • Infinite scrolling can be enabled with .isInfiniteScrollEnabled.
  • Interactive scrolling can also be controlled with .isScrollEnabled.

Insertion & Deletion

Pageboy provides the ability to insert and delete pages dynamically in the PageboyViewController.

func insertPage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)
func deletePage(at index: PageIndex, then updateBehavior: PageUpdateBehavior)

This behaves similarly to the insertion of rows in UITableView, in the fact that you have to update the data source prior to calling any of the update functions.

Example:

let index = 2
viewControllers.insert(UIViewController(), at: index)
pageViewController.insertPage(at: index)

The default behavior after inserting or deleting a page is to scroll to the update location, this however can be configured by passing a PageUpdateBehavior value other than .scrollToUpdate.

⚡️ Other Extras

  • reloadData() - Reload the view controllers in the page view controller. (Reloads the data source).
  • .navigationOrientation - Whether to orientate the pages horizontally or vertically.
  • .currentViewController - The currently visible view controller if it exists.
  • .currentPosition - The exact current relative position of the page view controller.
  • .currentIndex - The index of the currently visible page.
  • .parentPageboy - Access the immediate parent PageboyViewController from any child view controller.

Animated Transitions

Pageboy also provides custom transition support for animated transitions. This can be customized via the .transition property on PageboyViewController.

pageboyViewController.transition = Transition(style: .push, duration: 1.0)

Note: By default this is set to nil, which uses the standard animation provided by UIPageViewController.

Auto Scrolling

PageboyAutoScroller is available to set up timer based automatic scrolling of the PageboyViewController:

pageboyViewController.autoScroller.enable()

Support for custom intermission duration and other scroll behaviors is also available.

👨🏻‍💻 About

❤️ Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/uias/Pageboy.

Download Details:

Author: uias
Source Code: https://github.com/uias/Pageboy 
License: MIT license

#swift #pages #ios #view 

Harsha  Shirali

Harsha Shirali

1669174554

Replace Elements in Python NumPy Array with Example

In this article, we will learn how to replace elements in Python NumPy Array. To replace elements in Python NumPy Array, We can follow the following examples.

Example 1 : Replace Elements Equal to Some Value

The following code shows how to replace all elements in the NumPy array equal to 8 with a new value of 20:

#replace all elements equal to 8 with 20
my_array[my_array == 8] = 20

#view updated array
print(my_array)

[ 4  5  5  7 20 20  9 12]

Example 2: Replace Elements Based on One Condition

The following code shows how to replace all elements in the NumPy array greater than 8 with a new value of 20:

#replace all elements greater than 8 with 20
my_array[my_array > 8] = 20

#view updated array
print(my_array)

[ 4  5  5  7  8  8 20 20]

Example 3: Replace Elements Based on Multiple Conditions

The following code shows how to replace all elements in the NumPy array greater than 8 or less than 6 with a new value of 20:

#replace all elements greater than 8 or less than 6 with a new value of 20
my_array[(my_array > 8) | (my_array < 6)] = 20

#view updated array
print(my_array)

[20 20 20  7  8  8 20 20]

#python 
 

Monotone: An Unsplash Application for IOS

Monotone

Monotone is a Modern Mobile Application, integrated with powerful Unsplash API provided by Unsplash. It implemented almost all features including viewing, searching, collecting photos. And other features, such as profile, license, FAQ are supported as well.

This is an un-official application, exploring the feasibility of some conceptions is the goal of this project. Written in Swift, triggered by RxSwift, draw responsive constraints using SnapKit.

If you like this project or inspired by any ideas of this project, please star it without any hesitation. (ヽ(✿゚▽゚)ノ)

Overview

screen-record-1.gif screen-record-2.gif



 

Development Progress

Features

  •  Write Interfaces Programmatically
  •  Dark Mode Support
  •  Animation Effects
  •  Localization
  •  Powered by Unsplash API
  •  More...

Tasks

Currently supported tasks:

PositionModulePageStyle & LayoutPowered by DataAnimation EffectsLocalization
MainLoginSign Up & Sign In
PhotoList (Search & Topic)
View
Camera Settings
Collect (Add & Remove)
Share to SNS⬜️
Save to Album
Side MenuProfileDetails
MenuMy Photos
Hiring⬜️
Licenses
Help⬜️
Made with Unsplash⬜️
Tab BarStoreHome⬜️
Details⬜️
WallpaperList (Adapt Screen Size)⬜️
CollectionList
ExploreList (Photo & Collection)⬜️



 

Getting Started

This application uses Cocoapods to manage dependencies. Please refer to Cocoapods Offical Website to install & configure(If you already installed Cocoapods, skip this).

Prerequisites

Monotone is trigged by Unsplash API . The very first thing must be done is applying a pair of OAuth key to run it.

  1. Visit Unsplash, sign up then sign in.(If you already have an account, skip this).
  2. Visit Unsplash Application Registration Platform agree with terms and create a new application, the application name and description can be anything.
  3. After the application was created,it will redirect to the application details page automatically (Also can be found from https://unsplash.com/oauth/applications). At Redirect URI & Permissions - Redirect URI section, input monotone://unsplash, make sure all authentication options are checked, just like the image shown below.

  1. After the work is finished, check ”Access Key“ and ”Secret Key“ on this page, they will be used soon.

Installation

  1. Execute the following commands in the terminal:
# Clone to a local folder
git clone https://github.com/Neko3000/Monotone.git

# Direct to Project folder
cd Monotone

# Install Pods
pod install
  1. Under Monotone folder, duplicate config_debug.json file,and rename it to config.json(This file is ignored by .gitignore);
  2. Open config.json ,input your ”Access Key“ and ”Secret Key“,they will be copyed to APP folder when running.(For more information, please refer to the content in Project->Build Phases->Run Script and APPCredential.swift );
  3. Done,command + R。

     

Dependencies

ProjectDescription
RxSwiftFramework for Reactive Async Programming.
ActionBased on RxSwift,encapsulate actions for calling。
DataSourcesBased on RxSwift,extend logic interaction of tableview and collectionview。
AlamofireHTTP network library.
SwiftyJSONHandle JSON format data effectively.
ObjectMapperMap data between models and JSON.
KingfisherNetwork image cache libray with many functions.
SnapKitMake constraints effectively.
......

For more information,please check Podfile

Project Structure

The basic structure of this project.

Monotone 
├── Monotone
│   ├── /Vars  #Global Variables
│   ├── /Enums  #Enums (Includes some dummy data)
│   ├── /Application
│   │   ├── AppCredential  #Authentication Credential
│   │   ...
│   │   └── UserManager  #User Managment
│   ├── /Utils  #Utils
│   │   ├── /BlurHash  #Photo Hash
│   │   ├── ColorPalette  #Global Colors
│   │   ├── AnimatorTrigger  #Animation Effects
│   │   └── MessageCenter  #Message Notification
│   │── /Extension  #Extensions
│   │── /Services  #Services
│   │   ├── /Authentication  #Requests of Authentication
│   │   └── /Network  #Requesets of Data
│   │── /Components  #View Classes
│   │── /ViewModels  #View Models
│   │── /ViewControllers  #View Controllers
│   │── /Models  #Data Models
│   │── /Coordinators  #Segues
│   └── /Resource  #Resource
└── Pods


Designing

The interface you are seeing are all designed by Addie Design Co. They shared this document, everyone can free download it and use it. Those design elements and their level of completion are astonishing. This application would not be here without this design document.

Thanks again to Addie Design Co and this beautiful design document.



 

About Unsplash

Unsplash is a website dedicated to sharing high-quality stock photography under the Unsplash license. All photos uploaded by photographers will be organized and archived by editors.

And this website is one of my favorites, admired for its artistic, the spirit of sharing.
You will find my home page here. (Not updated frequently since 2020)



 

Contributing

Limited by data Unsplash API provides, some parts of this application only finished their styles and layouts(Almost in store, explore, etc). If the API provides more detailed data on these parts in the future, we will add new features as soon as possible.

Meanwhile, focusing on the current application, we will improve it continuously.

How to Participate in

If you are an experienced mobile application developer and want to improve this application. You are welcomed to participate in this open-source project. Practice your ideas, improve even refactor this application.

Follow standard steps:

  1. Fork this repo;
  2. Create your new Branch (git checkout -b feature/AmazingFeature);
  3. Add Commit (git commit -m 'Add some AmazingFeature');
  4. Push to remote Branch (git push origin feature/AmazingFeature);
  5. Open a Pull Request.

For anyone, open an issue if you find any problems. PRs are welcome.


Author: Neko3000
Source code: https://github.com/Neko3000/Monotone
License: MIT license

#swift 

Madelyn  Frami

Madelyn Frami

1598438700

10 Open Source/Commercial Control Panels For Virtual Machines (VM's) Management

Automatic creation and management of virtual machines is a topical issue for any company that provides VPS services. If you manage a large number of machines, a command line is definitely not the only tool you may need to perform various operations including client tasks, because such operations may be time-consuming.

In order to simplify routine tasks of server administrators and users, various companies develop control panels for virtual machines management, including interface-based solutions.

Don’t Miss20 Open Source/Commercial Control Panels to Manage Linux Servers

A control panel empowers you to perform any operation with a mouse click, whereas it would take you a good deal of time to complete the same task in the console. With a control panel, you will save your time and effort. However, it’s not all that simple.

Nowadays, VMmanager is the most popular software product for small and medium-sized businesses. VMware, in its turn, is a leading solution for large organizations. Both software products are commercial and rather expensive.

They deliver a large number of functions, however, some companies, especially, startups may need them. Besides, many of them cannot afford such an expensive product. For example, startups and companies in times of crisis may experience financial difficulties. Moreover, one can find interesting, outstanding solutions integrated with billing systems including tools for VM management.

How not to get lost among a great number of offers? We decided to help our users and wrote the following article, in which they will find answers to this question.

In this article, we will describe control panels for virtual machines management, both commercial and open-source, and help you choose the right solution to meet your personal needs.

1. VMmanager

VMmanager is one of the most popular commercial server virtualizations platforms based on QEMU/KVM technology. The solution has a reach feature set, that can suit both IT infrastructure owners and VPS services providers’ needs.

Virtual servers can be created within 2 minutes. Many routine tasks are performed automatically: including migration, cloning, reinstalling the OS, backups, adding and deleting interfaces, virtual server image creation, monitoring, statistics collection, server provisioning, etc.

The main advantages of VMmanager are:

  • Centralized management of various clusters.
  • Fault tolerance due to a microservice architecture.
  • Overselling, which helps to improve VPS provider’s equipment efficiency.
  • Complete control of the infrastructure thanks to a robust system of metrics collection.
  • A modern and intuitive interface.

VMmanager - Virtualization Management Platform

VMmanager – Virtualization Management Platform

2. VMware vSphere

VMware vSphere is the world’s leading server virtualization platform for building cloud infrastructure. With tons of its different powerful features, vSphere is a truely state-of-the-art software virtual machines management software. It is an ideal solution for large VPS providers with appropriate budgets and professional staff.

VMWare vSphere - Server Virtualization Platform

#control panels #virtualization #hosting control panel #linux control panels #virtual mahine control panels #linux

August  Larson

August Larson

1622800020

Guide to PyTerrier: A Python Framework for Information Retrieval

Information Retrieval is one of the key tasks in many natural language processing applications. The process of searching and collecting information from databases or resources based on queries or requirements, Information Retrieval (IR). The fundamental elements of an Information Retrieval system are query and document. The query is the user’s information requirement, and the document is the resource that contains the information. An efficient IR system collects the required information accurately from the document in a compute-effective manner.

Register for AWS ML Fridays and learn how to make a career in data science.

The popular Information Retrieval frameworks are mostly written in Java, Scala, C++ and C. Though they are adaptable in many languages, end-to-end evaluation of Python-based IR models is a tedious process and needs many configuration adjustments. Further, reproducibility of the IR workflow under different environments is practically not possible with the available frameworks.

Machine Learning heavily relies on the high-level Python language. Deep learning models are built almost on one of the two Python frameworks: TensorFlow and PyTorch. Though most natural language processing applications are built on top of Python frameworks and libraries nowadays, there is no well-adaptable Python framework for the Information Retrieval tasks. Hence, here comes the need for a Python-based Information Retrieval framework that supports end-to-end experimentation with reproducible results and model comparisons.

#developers corner #information #information extraction #information retrieval #ir #learn-to-rank #ltr #pyterrier #python #random forest #ranking #terrier #xgboost