1667103240
TL;DR UIPageViewController done properly.
Pageboy requires iOS 9 / tvOS 10; and is compatible with Swift 5.
Pageboy is compatible with Swift Package Manager and can be integrated via Xcode.
Pageboy is also available through CocoaPods:
pod 'Pageboy', '~> 3.7'
Pageboy is also available through Carthage:
github "uias/Pageboy" ~> 3.7
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
}
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.
About to embark on a transition to a new page.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
willScrollToPageAt index: Int,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
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)
Successfully completed a scroll transition to a page.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didScrollToPageAt index: Int,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
Child view controllers have been reloaded.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didReloadWith currentViewController: UIViewController,
currentPageIndex: PageIndex)
You can navigate programmatically through a PageboyViewController
using scrollToPage()
:
pageViewController.scrollToPage(.next, animated: true)
.isInfiniteScrollEnabled
..isScrollEnabled
.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
.
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.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
.
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.
Bug reports and pull requests are welcome on GitHub at https://github.com/uias/Pageboy.
Author: uias
Source Code: https://github.com/uias/Pageboy
License: MIT license
1667103240
TL;DR UIPageViewController done properly.
Pageboy requires iOS 9 / tvOS 10; and is compatible with Swift 5.
Pageboy is compatible with Swift Package Manager and can be integrated via Xcode.
Pageboy is also available through CocoaPods:
pod 'Pageboy', '~> 3.7'
Pageboy is also available through Carthage:
github "uias/Pageboy" ~> 3.7
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
}
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.
About to embark on a transition to a new page.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
willScrollToPageAt index: Int,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
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)
Successfully completed a scroll transition to a page.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didScrollToPageAt index: Int,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
Child view controllers have been reloaded.
func pageboyViewController(_ pageboyViewController: PageboyViewController,
didReloadWith currentViewController: UIViewController,
currentPageIndex: PageIndex)
You can navigate programmatically through a PageboyViewController
using scrollToPage()
:
pageViewController.scrollToPage(.next, animated: true)
.isInfiniteScrollEnabled
..isScrollEnabled
.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
.
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.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
.
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.
Bug reports and pull requests are welcome on GitHub at https://github.com/uias/Pageboy.
Author: uias
Source Code: https://github.com/uias/Pageboy
License: MIT license
1669174554
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.
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]
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]
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]
1655906400
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. (ヽ(✿゚▽゚)ノ)
Currently supported tasks:
Position | Module | Page | Style & Layout | Powered by Data | Animation Effects | Localization |
---|---|---|---|---|---|---|
Main | Login | Sign Up & Sign In | ✅ | ✅ | ✅ | ✅ |
Photo | List (Search & Topic) | ✅ | ✅ | ✅ | ✅ | |
View | ✅ | ✅ | ✅ | ✅ | ||
Camera Settings | ✅ | ✅ | ✅ | ✅ | ||
Collect (Add & Remove) | ✅ | ✅ | ✅ | ✅ | ||
Share to SNS | ✅ | ⬜️ | ✅ | ✅ | ||
Save to Album | ✅ | ✅ | ✅ | ✅ | ||
Side Menu | Profile | Details | ✅ | ✅ | ✅ | ✅ |
Menu | My Photos | ✅ | ✅ | ✅ | ✅ | |
Hiring | ✅ | ⬜️ | ✅ | ✅ | ||
Licenses | ✅ | ✅ | ✅ | ✅ | ||
Help | ✅ | ⬜️ | ✅ | ✅ | ||
Made with Unsplash | ✅ | ⬜️ | ✅ | ✅ | ||
Tab Bar | Store | Home | ✅ | ⬜️ | ✅ | ✅ |
Details | ✅ | ⬜️ | ✅ | ✅ | ||
Wallpaper | List (Adapt Screen Size) | ✅ | ⬜️ | ✅ | ✅ | |
Collection | List | ✅ | ✅ | ✅ | ✅ | |
Explore | List (Photo & Collection) | ✅ | ⬜️ | ✅ | ✅ |
This application uses Cocoapods
to manage dependencies. Please refer to Cocoapods Offical Website to install & configure(If you already installed Cocoapods
, skip this).
Monotone is trigged by Unsplash API . The very first thing must be done is applying a pair of OAuth key to run it.
Redirect URI & Permissions - Redirect URI
section, input monotone://unsplash
, make sure all authentication options are checked, just like the image shown below.# Clone to a local folder
git clone https://github.com/Neko3000/Monotone.git
# Direct to Project folder
cd Monotone
# Install Pods
pod install
config_debug.json
file,and rename it to config.json
(This file is ignored by .gitignore);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 );Project | Description |
---|---|
RxSwift | Framework for Reactive Async Programming. |
Action | Based on RxSwift,encapsulate actions for calling。 |
DataSources | Based on RxSwift,extend logic interaction of tableview and collectionview。 |
Alamofire | HTTP network library. |
SwiftyJSON | Handle JSON format data effectively. |
ObjectMapper | Map data between models and JSON. |
Kingfisher | Network image cache libray with many functions. |
SnapKit | Make constraints effectively. |
... | ... |
For more information,please check Podfile。
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.
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)
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.
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:
Fork
this repo;Branch
(git checkout -b feature/AmazingFeature
);Commit
(git commit -m 'Add some AmazingFeature'
);Push
to remote Branch
(git push origin feature/AmazingFeature
);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
1598438700
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 Miss: 20 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.
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:
VMmanager – Virtualization Management Platform
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.
#control panels #virtualization #hosting control panel #linux control panels #virtual mahine control panels #linux
1622800020
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