Questions tagged [perfect]
Perfect is a framework for developing web and other REST services in the Swift programming language. It lets developers build using only Swift to program both the client-facing and server-side of their projects.
128
questions
3
votes
1
answer
1k
views
How do I make Pixel Perfect Camera scale like Normal Camera in Unity 2D
This is my scene
Right now if I use resolutions that aren't 16:9 the Pixel Perfect Camera zooms out quite a lot showing parts that shouldn't be shown.
How do I get it to scale like the Normal Camera ...
0
votes
1
answer
86
views
calling perfectly forwarded lambda
I have the following class which stores a perfectly forwarded reference to a function:
template <class F>
class Visitor
{
public:
Visitor(F &&f) : _f(std::forward<F>(f))
{...
1
vote
0
answers
73
views
PerfectTemplate got "Fatal error: UnsafeMutablePointer.initialize overlapping range" under Relase Mode
I followed the instructions of "Getting Started with Perfect"(https://perfect.org/docs/gettingStarted.html)
git clone https://github.com/PerfectlySoft/PerfectTemplate.git
cd PerfectTemplate
...
0
votes
1
answer
66
views
Displaying perfect numbers and their adders
I need help with the program to display first 4 perfect numbers in the standard output and also funciton perfect(int,int*). Arguments of this function are natural number and the adress where you neeed ...
2
votes
1
answer
81
views
Making a route both intermediate and final?
In building an app with PerfectHTTP I've come up against a problem with routing: Routes that are used as intermediate routes cannot also be used as final routes.
When set up as below, some URLs track ...
1
vote
0
answers
58
views
build perfect swift server side development No account for a team "ABCDEFGH"
I'm trying to create a web api using Swift Perfect. Every time I build the project file, my team name was changing to this ABCDEFGH name. For each and every dependency again I need to change the ...
1
vote
0
answers
165
views
Using Perfect-Markdown, tables are not rendering like GitHub's UI
I'm using the Perfect framework and importing Perfect-Markdown to render my README.md on the landing page of my REST service.
Simply put, I'm attempting to render a table that looks something like:
...
1
vote
2
answers
171
views
PerfectSwift: swift package update runs endlessly
I do have an older Perfect Swift project where my package.swift looks the following:
// Generated automatically by Perfect Assistant Application
// Date: 2017-09-24 18:44:24 +0000
import ...
0
votes
1
answer
126
views
why is swift build failing on app engine?
I am running the tutorial from here but seem to be running in a build step that is likely just my inexperience with docker. I get the following build error
'Munger-API' /root/Munger-API: error: could ...
1
vote
1
answer
158
views
How to change process title in Swift on Linux?
Python: setproctitle
How to do the same thing in Swift?
3
votes
1
answer
184
views
Location of webroot (for css file) in Perfect app
I've cloned the PerfectTemplate project and am using it to serve up html as follows…
import PerfectHTTP
import PerfectHTTPServer
var routes = Routes()
routes.add(method: .get, uri: "/test") { ...
1
vote
1
answer
301
views
Unable to redirect to url using Server Side Swift Perfect
I'm using Server Side Swift Perfect framework for web services.
Mustache module for serving static/dynamic content.
I want to implement login functionality following a redirect to the homepage on ...
-1
votes
2
answers
1k
views
Finding the perfect pth power of a number using Java when the number is a fraction
We say p is the perfect pth power of a number x if x can be expressed as another number b^p.
i.e if x=b^p , then p is the perfect pth power of x.
I have few use cases where x can be either a ...
2
votes
0
answers
75
views
Perfect Assistant - Error in Importing Existing Package
Version: Perfect Assistant v 3.0.5
Swift: 4.1.2
Target: x86_64-apple-darwin17.7.0
I cloned, built and ran the PerfectTemplate package. Everything runs perfectly (pun intended). I have not (yet) ...
0
votes
0
answers
345
views
Couldn't bind Server Side Swift Perfect app to Port 80
I have launched my AWS ec2 instance and set up my Perfect Server side swift Project in remote machine- (Ubuntu 16.04). It's is working perfectly fine on developer ports, I mean other than port 80.
...
0
votes
1
answer
31
views
How to use Perfect(Swift) under a VirtualHost(Apach)?
I have Apache on Ubuntu OS. My Ubuntu use amazon Lightsail. I set up a VirtualHost for use the Perfect web server like this
<Location "/PerfectTemplate">
ProxyPass http://localhost:8182
...
0
votes
0
answers
51
views
algorithm for 'generalized' matching in complete graphs
My problem is a generalization of a task solved by [Blossom algorithm] by Edmonds. The original task is the following: given a complete graph with weighted undirected edges, find a set of edges such ...
0
votes
1
answer
112
views
Deploy perfect swift with heroku
I have created backend with perfectswift. Now I am trying to deploy that with heroku but I am getting some kind of error while pushing. Help me to solve this issue.
1
vote
0
answers
146
views
Swift command line linking fails with "duplicate symbols" error
I am referencing some C projects in my Package.swift. Recently I have added a project that references other C projects in its own Package.swift file, and while those C projects are different from my ...
0
votes
2
answers
173
views
SSL redirect changes client IP address read from HTTPResponse
I am using Perfect Framework for my server side application running on an AWS EC2 instance. I am using the following code to get client IP address.
open static func someapi(request: HTTPRequest, _ ...
1
vote
1
answer
44
views
How to delete old IAM Credentials in Perfect Assistant - Server Side swift?
I am trying to delete old IAM Credentials in Perfect Assistant? of course I know how to delete IAM credentials in AWS but I need to clear it on my mac for Perfect Assistant. I can't find the ...
1
vote
1
answer
614
views
WKWebView fails to load static files when served via PerfectHTTPServer
I'm trying to load WKWebView by running a local server (PerfectHTTPServer), and serving files from the documents folder in the iPhone application. The path is correct since this works with a server ...
4
votes
2
answers
1k
views
Cannot invoke 'reduce' with an argument list of type '(String, (String) -> String)'
I am trying to convert Swift 3 to Swift 4 for a repo on github. Here is a function that blocks me.
func times(_ n: Int) -> String {
return (0..<n).reduce("") { $0 + self }
}
The error ...
3
votes
0
answers
231
views
Running Swift Perfect and NGINX
So I have a Swift server-side app running on my Ubuntu box, it's using the Perfect Framework and runs on port 8080.
I want NGINX to forward requests on port 80 to port 8080 (behind the scenes)
My ...
1
vote
1
answer
730
views
How to lock/unlock variable in Swift Perfect framework
How to lock var transactions in Swift Perfect framework, to avoid inserting new transaction by some other thread, just before I remove all items in function storeTransactions():
class Foo {
var ...
0
votes
1
answer
122
views
Perfect-MySQL majorVersion:3 Undefined symbols for architecture x86_64:
I get an
ld: symbol(s) not found for architecture x86_64
error while building from terminal (swift build) (swift 4).
It points to a simple init in my code like:
let mysql = MySQL()
Two hints:
...
1
vote
1
answer
597
views
Using CommonCrypto/CommonHMAC.h in Swift on Linux (Ubuntu) to get SHA256
I am trying to build:
static func sha256(string: String) -> String? {
if let data = string.data(using: .utf8) {
var hash = [UInt8](repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH))
...
0
votes
2
answers
256
views
Command 'swift build' - infinity building
I've downloaded example project from this http://perfect.org/docs/gettingStarted.html and commands, swift build and next swift package generate-xcodeproj working great.
Than I want to add another ...
2
votes
1
answer
228
views
Perfect template
I'm running this code in swift with the perfect template framework using Swift Package Mannager
var values: MustacheEvaluationContext.MapType
func extendValuesForResponse(context contxt: ...
4
votes
2
answers
172
views
Role Based Access Authorization in perfect
Being new to perfect server side swift, I cannot find any packages that help with role based access authorization. In Spring there is for example,
.antMatchers("/homePage").access("hasRole('ROLE_USER'...
1
vote
1
answer
212
views
How to create a Proxy Server using Swift Perfect Framework?
I want to use Swift Perfect Framework to make a proxy server.
My idea is following:
get the request's url ,header.etc informations.
use the informations to create new request.
get response from the ...
0
votes
1
answer
288
views
How to deal with Parsing Object from Join Query
I'm currently working on my first API with the Perfect framework. It's been a while since I made an API myself so I must admit my SQL and API logic is a little rusty.
I'm using a MySQL database for ...
2
votes
2
answers
1k
views
How to implement multicast sockets in swift?
I'm writing a server that, among other things, needs to be constantly sending data in different multicast addresses. The packages being sent might be received by a client side (an app) which will be ...
23
votes
3
answers
11k
views
Load balancing sockets on a horizontally scaling WebSocket server?
Every few months when thinking through a personal project that involves sockets I find myself having the question of "How would you properly load balance sockets on a dynamic horizontally scaling ...
6
votes
2
answers
1k
views
swift server side server socket error
I'm suffering from server problem on both perfect and vapor ..
The server working for only one time , and once after i update the project and rebuild it, the server response does not update any more.
...
2
votes
1
answer
616
views
Why is the --clean not available any more for Swift command line? How to do clean now?
I try to clean the build by following the instruction in Perfect (Server side Swift framework):
swift build --clean
but it shows error:
error: unknown option --clean; use --help to list available ...
1
vote
0
answers
73
views
Perfect-Notifications: Unable to write frame
I'm sending push notifications like so:
var items:[APNSNotificationItem] = [.customPayload("body",body),.contentAvailable]
if alert
{
items.append(.badge(badge))
items....
1
vote
1
answer
66
views
Unwrapping long datatype in Swift Linux
I'm trying to get a record from MongoDB which has a DateTime property. This property is ISODate but is received as a long data type (milliseconds since 1970) through the Perfect-MongoDB API.
The ...
0
votes
1
answer
274
views
Parse with Perfect CURL Swift
I've been trying to make a server side Swift program which downloads the JSON data from Parse using Parse's cURL call.
For this to work, I need to use a package for Swift called "Perfect cURL" which ...
1
vote
2
answers
267
views
How to get serverside file uploading progress in Perfect
I'm trying to create a web page using Perfect(perfect.org), Where users will browse and upload files. Can anyone tell me how can I get the progress of file upload?
1
vote
1
answer
168
views
How do i deploy a Perfect (swift) backend code + PostgreSQL to Google App Engine
i'm pretty new to web development and much more in Google Cloud, sorry for anything.
Basically, i'm doing the backend part of an app in Swift (using Perfect), and it's running smoothly and okay in my ...
2
votes
1
answer
205
views
Perfect Asistant: Build Linux failed due to module cache path on linux vs macOS
I tried to follow along the Perfect screencast from RayWenderlich on a Mac. On Perfect Asistant (2nd screencast), he showed using Perfect Assistant, we could just click on the Build Linux and it will ...
-3
votes
2
answers
489
views
Is there a db connection pool for swift in perfect?
I am looking for a database connection pool wrapper for perfect (swift 3 or above). I couldn't find any through search so I decided to ask if someone could provide a hint.
Thanks in advance
3
votes
2
answers
2k
views
Swift 3: Method expecting variadic String parameter can only receive single String argument
I'm calling a method expecting a String... variadic parameter, but the only thing it allows receiving from the enclosing function is a plain String.
My method looks like this:
public func ...
0
votes
1
answer
269
views
value of type 'Scanner' has no member 'scanHexInt32'
When I compile my Swift project for Mac it compiles fine but when I compile same code in Ubuntu 16.04 I get following error.
value of type 'Scanner' has no member 'scanHexInt32'
if Scanner(...
1
vote
1
answer
184
views
Xcode file path error
I am developing backend with Perfect + Swift3, I want to load a text file with configuration. When I run the project in Xcode8 id does not detect the text file. However when I build the app for linux ...
0
votes
1
answer
434
views
With Perfect/Swift mySQL Must You Have a Single Database Connection Per Request?
With Perfect/mySQL (https://github.com/PerfectlySoft/Perfect-MySQL), the examples I've seen suggest that you cannot reuse a single database connection across multiple connections. That is, you need a ...
0
votes
1
answer
94
views
Using 'Any' and 'AnyObject' types in Swift Linux gives errors
I have this line of code:
produceJSONMessage(message: message as AnyObject)
That works ok in XCode (Mac). However building it in linux using swift build produces an error:
/home/ubuntu/x/x/objects....
1
vote
2
answers
223
views
Point domain to a Web Application running on OS X Server (ex. Kitura, perfect, vapour server)
Using the OS X server application, I can point multiple domains to various websites. All domains can use port 80 at the same time and OS X will resolve which website to use.
When I start my kitura ...
2
votes
1
answer
159
views
Redirect all HTTP to HTTPS without ELB
I'm trying to redirect all my APIs and web HTTP requests to HTTPS in Swift Perfect. I have deployed code into AWS. When I Googled, all I'm getting is using ELB which I'm not using. Are there any ...