Sergen path not found - serenity-platform

I have both StartSharp and Serenity installed
I was running "dotnet sergen g" in a Serenity 5.0 project
and received the following path error
Path Error
Lines 84 and 85 in GenerateCommand.cs
var path = Path.Combine(projectDir, name); if (File.Exists(name))
should they be
var path = Path.Combine(projectDir, name); if (File.Exists(path))
or do I have another kind of problem?

Related

Error in file uploading Podio API

Can someone please help me in uploading file in Podio? I am new in Podio library so I am trying but getting lots of errors.
Warning: realpath() expects parameter 1 to be a valid path, resource given in /home/gphxyz/public_html/decode/podio-php/models/PodioFile.php on line 54
Warning: filesize() expects parameter 1 to be a valid path, resource given in /home/gphxyz/public_html/decode/podio-php/models/PodioFile.php on line 54
Fatal error: Uncaught PodioBadRequestError: "'source' parameter must given as multipart/form-data with type 'file'"
Request URL: http://api.podio.com/file/v2/
Stack Trace: #0 /home/gphxyz/public_html/decode/podio-php/lib/Podio.php(352): Podio::request('POST', '/file/v2/', Array, Array)
#1 /home/gphxyz/public_html/decode/podio-php/models/PodioFile.php(54): Podio::post('/file/v2/', Array, Array)
#2 /home/gphxyz/public_html/decode/podio-php/index.php(22): PodioFile::upload(Resource id #72, 'http://geeksper...')
#3 {main} thrown in /home/gphxyz/public_html/decode/podio-php/lib/Podio.php on line 289
My code is below:
<?php
require_once 'PodioAPI.php';
//Initalize Podio connection
$client_id = '';
$client_secret = "";
Podio::setup($client_id, $client_secret);
//App ID's
$opname_app_id = '21209880';
$opname_app_token = "";
Podio::authenticate_with_app($opname_app_id, $opname_app_token);
$opname_auth = Podio::$oauth;
$filepath = 'http://geeksperhour.xyz/decode/podio-php/credit.jpg';
$filename = 'credit.jpg';
$goFile = PodioFile::upload($filepath, $filename);
$fileID = $goFile->file_id;
print_r($fileID);
You might find that lib/podio.php for file uploads is deprecated since a while.
See the open Ticket on Github: The usage of the #filename API for file uploading is deprecated - File upload #74
Changing the API in line 189 will allow you to follow the documentation again.
from
if (!empty($options['upload'])) {
curl_setopt(self::$ch, CURLOPT_POST, TRUE);
curl_setopt(self::$ch, CURLOPT_SAFE_UPLOAD, FALSE);
curl_setopt(self::$ch, CURLOPT_POSTFIELDS, $attributes);
self::$headers['Content-type'] = 'multipart/form-data';
}
to
if (!empty($options['upload'])) {
$cfile = curl_file_create(substr($attributes[ "source" ], 1));
// Assign POST data
$attributes[ "source" ] = $cfile;
curl_setopt(self::$ch, CURLOPT_POST, TRUE);
curl_setopt(self::$ch, CURLOPT_POSTFIELDS, $attributes);
self::$headers['Content-type'] = 'multipart/form-data';
}
Worked for me in a PHP 7.2 Ubuntu 16.04 environment.
Also make sure the path to your file is pointing to local a path of your server.
Additional if you use composer you might find it useful to point to the master rather than the latest release:
composer require podio/podio-php:dev-master
As error message says: expects parameter 1 to be a valid path, resource given in /home/gphxyz/public_html/decode/podio-php/models/PodioFile.php on line 54
So, please provide valid local file path instead of $filepath = 'http://geeksperhour.xyz/decode/podio-php/credit.jpg';

mbrola Binary for linux CentOS

I am trying to use mbrola binary on CentOS box. I tried many binary listed on below page but none is working.
http://www.tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html
I am getting following error -
Processing Utterance: com.sun.speech.freetts.ProcessException: Cannot start mbrola program:
I believe this is most likely incompatible binary for CentOS.
Can you please tell me if there is a binary available for CentOS ?
Code -
public static void createAudioFile(String text, String fileName) {
AudioPlayer audioPlayer = null;
//System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_time_awb.AlanVoiceDirectory");
System.setProperty("mbrola.base", Constants.mbrolaDiskPath);
Voice voice;
VoiceManager vm = VoiceManager.getInstance();
voice = vm.getVoice("mbrola_us1");
voice.allocate();
try{
String directoryPath = audioDir+fileName;
audioPlayer = new SingleFileAudioPlayer(directoryPath,Type.WAVE);
voice.setAudioPlayer(audioPlayer);
voice.speak(text);
voice.deallocate();
audioPlayer.close();
}
catch(Exception e){
e.printStackTrace();
}
}
I found Mbrola binary for CentOs from following location -
http://rpm.pbone.net/index.php3/stat/4/idpl/30430620/dir/centos_7/com/mbrola-301h-7.1.x86_64.rpm.html#content
Steps to follow -
1. Download the following rpm
ftp.gwdg.de mbrola-301h-7.1.x86_64.rpm
run > rpm -ivh mbrola-301h-7.1.x86_64.rpm. This will install mbrola binary into /usr/bin.
Copy /usr/bin/mbrola to your preferred location and set mbrola.base to it as - System.setProperty("mbrola.base", Constants.mbrolaDiskPath);
done.

Selenium/PhantomJS Can't Find Javascript in Webjars

I am running a simple log in test using PhantomJS 1.9.8 and Selenium 2.42.2. Everything is setup with maven and I am using embedded Jetty 8.1.14.v20131031.
Before starting jetty I also add all the webjars to org.eclipse.jetty.webapp.WebAppContext#setExtraClasspath
My login.jsp is using webjars to reference jquery.
<script src="webjars/jquery/1.10.2/jquery.js"></script>
When I run my test I get the following error:
Session [81d93a00-9101-11e5-bc34-79a9cbd8ffe4] - page.onError - msg: ReferenceError: Can't find variable: $
If I change the login.jsp to the full URL the test passes.
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
Is it PhantomJS that is having a problem reading from the webjars or is it Jetty not serving them?
The key was to iterate over the webjars and add each as a classpath resource.
//Ensure that webjars are visible as they are packaged in META-INF/resources
ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
Resource[] webjarResources = patternResolver.getResources("classpath*:/META-INF/resources");
String[] resources = new String[webjarResources.length + 1];
for(int i = 0; i < webjarResources.length; i++) {
Resource webjarResource = webjarResources[i];
resources[i] = webjarResource.getURI().toString();
}
//Try to find the webapp source regardless of the current working directory
URL resource = this.getClass().getClassLoader().getResource("app.properties");
String resourcePath = resource.getPath();
String root = resourcePath.substring(0, resourcePath.lastIndexOf("myapp"));
String path = root + "myapp/src/main/webapp";
File webAppDir = new File(path);
resources[resources.length - 1] = webAppDir.getAbsolutePath();
webapp.setBaseResource(new ResourceCollection(resources));

How do you include multiple activities in the Gradle Liquibase plugin's runList field?

I’m using Gradle 2.7 on Mac Yosemite with Java 8. I’m using the Liquibase 1.1.1 plugin and would like to use it to do a couple of activities (build a test database and build my normal database). So I have
liquibase {
activities {
main {
File propsFile = new File("${project.rootDir}/src/main/resources/liquibase.properties")
Properties properties = new Properties()
properties.load(new FileInputStream(propsFile))
changeLogFile 'src/main/resources/db.changelog-master.xml'
url properties['url']
username properties['username']
password properties['password']
}
test {
url 'jdbc:h2:file:target/testdb'
username 'sa'
}
runList = (
"test"
"main"
)
}
}
But I can’t figure out the proper syntax for runList. I get the error when running the above …
* Where:
Build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle' line: 163
* What went wrong:
Could not compile build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle'.
> startup failed:
build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle': 163: expecting ')', found 'main' # line 163, column 2.
"main"
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
According to one of there example, the runList must be placed after the activity block:
liquibase {
activities {
main {
File propsFile = new File("${project.rootDir}/src/main/resources/liquibase.properties")
Properties properties = new Properties()
properties.load(new FileInputStream(propsFile))
changeLogFile 'src/main/resources/db.changelog-master.xml'
url properties['url']
username properties['username']
password properties['password']
}
test {
url 'jdbc:h2:file:target/testdb'
username 'sa'
}
}
runList = 'test, main'
}
See the example here.
Hope this helps.

IncludeDirectory generate error Invalid file name for file monitoring

Code
var styleBundle = new StyleBundle("~/Content/Common") { Orderer = new FileBundleOrderer(server.MapPath("/Content/bundle.txt")) }
.IncludeDirectory("~/Content", "*.css", false);
Error message:
Invalid file name for file monitoring: '{ProjectPath}\Content'. Common
reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.
'{ProjectPath}\Content' Content directory exist in project directory!!
Package version:
Microsoft.AspNet.Web.Optimi... 1.1.0