2018-10-22         Herman

cucumber-js parse error when run on Jenkins

I am trying to setup a jenkins pipeline step to runs some test scenarios using cucumber-js but I am getting an error back from the build as follows:Error: Parse error in 'e2e/definitions/login.js': (1:1): expected:#EOF, #Language, #TagLine, #FeatureLine, #Comment, #Empty, got 'const { Given, When, Then } = require('cucumber');'The command being run in the pipeline step is as follows:cucumber-js e2e/features/**/*.feature --require e2e/**/*.jsThe opening lines of the login.js file the error is referencing are:const { Given, When, Then } = require('cucumber');const { Selector ...

 node.js                     2 answers                     33 view
 2018-10-22         Herman

slangword from text file in python

import redef main(): slang_file = [line.strip().split(":") for line in open("dictionary.txt")] slang = {k:v for k, v in slang_file} sentence = input("enter a sentence to translate\n") print(re.sub(r"\w+", lambda m: slang.get(m.group(0), m.group(0)), sentence))main()Dictionary contain of this:meee:mer:areBut I always got this type of error:slang = {k:v for k, v in slang_file}ValueError: too many values to unpack (expected 2)The output that i want is like this:r u hungryare you hungry Some of the lines in your dictionary.txt may contain more than one colon, so...

 python                     1 answers                     75 view
 2018-10-22         Herman

How to map column names from df to another rapidly?

I have a df that looks this:dfid email adress1 a@a main st I have another df that looks like this: df1Id Field1 id2 email 3 addressHow do I rename columns in df1 to the Id values in df2 so that the df1 looks like this:1 2 3 1 a@a main st I have used .map() but actually had to write the mapping myself. You have rename df1.rename(columns=df2.set_index('field name').id)Out[10]: 1 2 30 1 a@a mainst [XXX]

 python                     1 answers                     25 view
 2018-10-22         Herman

how to convert datetime by removing nanoseconds

I have sample CSV data which have Time in the following format2014-04-29 00:00:01.933000,2014-04-29 00:00:01.933000I can do pd.to_datetime(data['ts']) and also pd.DatetimeIndex(data['ts'])but how to format the output as %Y-%m-%d %H:%M:%S or basically to be removed the nanoseconds.This simple dateformatter seems to be missed out from all docs, I have read in pandas. I know the alternative is to convert to the floatnp.floor(pd.DatetimeIndex(pd.to_datetime(sdfeed1['ts'])).astype(int64)/1e9)I don't like this ugly approach. Is there any simple way to convert array of date-times ...

 python                     3 answers                     19 view
 2018-10-22         Herman

How to trim white space in StringBuffer in JAVA

This question already has an answer here: Scanner is skipping nextLine() after using next() or nextFoo()? 15 answers sc.nextInt() doesn't consume the newline at the end of the line containing the number.Add sc.nextLine(); after it:num = sc.nextInt();sc.nextLine(); [XXX]

 java                     1 answers                     45 view
 2018-10-22         Herman

Swift - Read nested structures with for loop

I'm trying to read nested structures with a for loop in my BLE project. The main purpose is to update a global structure with new values from my peripheral. In total i have maybe 60 attributes, so using a loop would help me a lot. The structures are: /* ----------------------------------------------------------------------------- Attributes structure ----------------------------------------------------------------------------- */struct IthetisAttribute{ let UUID: String let Length: UInt8 let Service: String var Value: UInt32}/* ----------------------------------...

 swift                     1 answers                     79 view
 2018-10-22         Herman

Naviagation Page is not setting BarBackgroundColor in XAML

Below is the code for XAML for customNavigation in Xamarin. The bar color is not set but Bar text color is set. And this is only happening in Android, iOS works fine.<NavigationPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="DSXMobile.Views.CustomNavigationView" BarBackgroundColor="Red" BarTextColor="Black"></NavigationPage>Can anyone please help me ? This is a known issue, From Xamarin forums https://forums.xamarin.com/discussion/88569/barbackgr...

 xaml                     2 answers                     11 view
 2018-10-22         Herman

ajax load data from php page and mysqli

I have a database that contains information for x variable. I want to have php page that load datafrom mysqli with ajax and my phpapi page. so I create my database and it fills up every 1 minute.I create a php page that load a data from mysqli and output with this is my php page that load data from my mysqli and it working rightthis is myphpapi.php page<?php$con = mysqli_connect("x.x.x.x","boob","booob");if (!$con){ die('Could not connect: ' . mysqli_error());}mysqli_select_db($con,"sss");$sql = "SELECT `x` FROM ddd order by id desc limit 1";$result = mysqli_query($co...

 php                     1 answers                     99 view
 2018-10-22         Herman

Time between date. (More advanced than just Datediff)

I have a table that contains Guest_ID and Trip_Date. I have been tasked with trying to find out for each Guest_ID how many times they have had over 365 days between trips. I know that for the time between the dates I can use datediff formula but I am unsure of how to get the dates plugged in properly. I think if I can get help with this part I can do the rest.For each time this happened I need to report back Guest_ID, Prior_Last_Trip, New_Trip, days between. This data goes back for over a decade so it is possible for a Guest to have multiple periods of over a year between v...

 sql                     1 answers                     63 view
 2018-10-22         Herman

How to run stored procedure 1000 times

I have a stored procedure that I'm using to populate a table with about 60 columns. I have genereated 1000 exec statements that look like this:exec PopulateCVCSTAdvancement 174, 213, 1, 0, 7365exec PopulateCVCSTAdvancement 174, 214, 1, 0, 7365exec PopulateCVCSTAdvancement 175, 213, 0, 0, 7365Each time the stored procedure will be inserting anywhere from 1 to 3,000 records (usually around 2,000 records). The "server" is running desktop hardware with 4 gigs of available memory on a server OS. The problem I have is that after the first 10-15 executes of an average of 1-2 se...

 sql-server                     3 answers                     74 view
 2018-10-22         Herman

Can I get some help to reason about the `concurrent prime sieve` example?

I am very new to go, Can someone help me to reason about this example:// A concurrent prime sievepackage main// Send the sequence 2, 3, 4, ... to channel 'ch'.func Generate(ch chan<- int) { for i := 2; ; i++ { ch <- i // Send 'i' to channel 'ch'. }}// Copy the values from channel 'in' to channel 'out',// removing those divisible by 'prime'.func Filter(in <-chan int, out chan<- int, prime int) { for { i := <-in // Receive value from 'in'. println("debug", i, prime) if i%prime != 0 { out <- i // Send 'i' to 'ou...

 go                     2 answers                     64 view
 2018-10-22         Herman

How do i reset the forgotten password of glassfish server 4

Recently, i change the password for admin, and unfortunately i don't remember the password of my glassfish server 4. How, can i reset the password.I've followed the instruction provided in the following link "https://superuser.com/questions/7654/how-to-reset-delete-my-glassfish-password", but it didn't help me.i went to this path "../glassfish4/glassfish/domains/MyDomain/config/" and change the "admin-keyfile" file, but still it didn't help me. Finally, after few hours of posting the question, i found a solution.On my glassfish installed directory, this in my case /gl...

 glassfish-4                     1 answers                     53 view
 2018-10-22         Herman

Using svn with xampp for php projects

I have heard a lot about version control and would like to work on it. I read some tutorials about the same. However i am not quite sure how svn works with xampp.I have installed svn, Tortoise svn and made the necessary changes in xampp. For instance i copied the two required modules to c:/xampp/apache/modules and also made changes to the conf file in apache. Here are the changes made in c:/xampp/apache/conf/httpd.conf.# Configure Subversion repository<Location /svn>DAV svnSVNPath C:\svnAuthType BasicAuthName “Subversion repository”AuthUserFile c:\svn_conf\passwdRequi...

 svn                     3 answers                     49 view
 2018-10-22         Herman

How to create a public url for a Webapp

I have been given an assignment for User registration and login using Spring boot. Front end I have used thymeleaf.I have developed the application in my localhost.Below are the deliverableDeliverables ● Source code ---- Done with GitHub ● Public working url of the webapp --- How to do??? ● Tests - unit and integration tests. you may also choose to use a ci ---- Done I would like to know how to create a public working URL for a project developed on localhost. This process is called deployment. You may use Heroku, just follow the instructions. At the end, you will get...

 java                     1 answers                     82 view
 2018-10-22         Herman

Passing defined parameters to the Power BI Embeded

It is possible to define the parameters in the Power BI Desktop as per this feature (https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/7141377-allow-runtime-parameters-in-power-view-and-or-powe).Is it possible to send this parameter from the target application (ASP.NET MVC) of the Power BI Embedded? Power BI Embedded does not support parameters yet but you can pass in one additional filter value on the embed URL when you render the IFrame:report.EmbedUrl = report.EmbedUrl + "&$filter=table/column eq 'value'"; [XXX]

 asp.net-mvc                     1 answers                     74 view
 2018-10-22         Herman

AWS / Python Lambda function checking if a query string is present

Within my lambda function, which takes in event api query strings, I want to check if one is present. The below works if it is:if event['queryStringParameters']['order'] == 'desc': file_names.append('hello')I have tried event['queryStringParameters']['order'] != null but if there is no order query string used the lambda function the function breaks causing a 502 response. How do I check if a query string is not used without it breaking? Always check if the dict contains an key before referencing it.if 'queryStringParameters' in event and 'order' in event['querySt...

 python                     1 answers                     80 view

Page 1 of 144  |  Show More Pages:  Top Prev Next Last