How i can save a log with powershell in format pdf? - powershell

Actually i make one test unit that print this result:
info: serving app on http://127.0.0.1:4000
Usuario
superagent: Enable experimental feature http2
✓ realiza um registro de usuário (511ms)
✓ realiza login com o usuário registrado (142ms)
✓ realiza login com dados incorretos (145ms)
PASSED
total : 3
passed : 3
time : 2s
If i try to export this log in format .txt i have several problems with special characters and accents, as you can see:
adonis test > yourfile.txt
When i open the "yourfile.txt":
[32minfo[39m: serving app on http://127.0.0.1:4000
Usuario
Ô£ô realiza um registro de usu├írio (456ms)
Ô£ô realiza login com o usu├írio registrado (135ms)
Ô£ô realiza login com dados incorretos (126ms)
PASSED
total : 3
passed : 3
time : 1s
I'm thinking if there's a way to export this log in pdf to workaround this problem or if there's a way to show the special characters/accents correctly.
if i do a adonis test > yourfile.pdf the pdf generated is broken.

This may have to do with OutputEncoding.
Try:
$enc = [Console]::OutputEncoding
[Console]::OutputEncoding = [text.encoding]::utf8
adonis test | Out-File yourfile.txt -Encoding utf8 -Force
[Console]::OutputEncoding = $enc

Related

API GET Request works fine with curl, but with powershell not

Good afternoon,
If I send this curl request via a command line it works fine. But when I use my powershell script I don't get the same result.
CURL script:
CURL --request GET "https://staging.tiptrack.nl/Tiptrack.Employer.Api/odata/EmployeeBudgets?$expand=Employee($expand=SecureEmployee)&$top=5" -H "accept: application/json" -H "Authorization: Bearer token"
Powershell script:
#------- Opvragen token tiptrack -------
#Dit is de URL waar de token voor tiptrack wordt opgevraagd.
$Url_token="https://tiptracknext-staging-login.indicia.nl/oauth2/aus342go9hNphcHXM0i7/v1/token"
#Dit is de body die mee wordt gestuurd in de request, deze informatie staat gelijk aan de data in de post request vanuit de handleiding.
$Data_token = #{
grant_type="client_credentials"
client_id="123456"
client_secret="123456"
scope="api"
}
$token_tiptrack=Invoke-RestMethod -Method Post -Uri $Url_token -ContentType "application/x-www-form-urlencoded" -Body $Data_token
#------- Opvragen Employerbudgetsid -------
#Dti is de URL waarna de GET request wordt gestuurd om het employerid te kunnen.
$Url_budgetid="https://staging.tiptrack.nl/Tiptrack.Employer.Api/odata/EmployeeBudgets?$expand=Employee($expand=SecureEmployee)&$top=5"
#Dit is header die mee wordt gestuurd in de request. Deze data in deze header staat gelijk aan de data in de API handleiding.
$header_process = #{
Authorization='Bearer '+$token_tiptrack.access_token
"accept"="application/json"
}
#Vanuit het uploaden van het bestand krijgen we een reactie van de server, in deze reactie staat het upload id, deze id hebben we nodig om het bestand te kunnen verwerken.
Invoke-RestMethod -Uri $Url_budgetid -Method Get -Headers $header_process | Select-Object -ExpandProperty value
I hope someone can help me with this problem. With the CURL action i get the first 5 rows and by powershell i get all avilible rows.
To pass a string value as verbatim or literal, it is favorable to use single quotes or backtick escape PowerShell's special characters. If you have no variable references within a string, single quotes is easiest.
# Using Single Quotes
$Url_budgetid='https://staging.tiptrack.nl/Tiptrack.Employer.Api/odata/EmployeeBudgets?$expand=Employee($expand=SecureEmployee)&$top=5'
# Escaping the $ while using double quotes
$Url_budgetid="https://staging.tiptrack.nl/Tiptrack.Employer.Api/odata/EmployeeBudgets?`$expand=Employee(`$expand=SecureEmployee)&`$top=5"
Using double quotes to surround a string makes the string expandable. When the code is run $ followed by legal variable name characters will be interpreted as variable references. In your session, $expand and $top would be substituted for their values, which would be $null if you had not defined them. As a result, it appears those strings are removed from the URI. You can see this happening just by typing $Url_budgetid at the console.

Enterprise Architect - Import relations

I have a model in Enterprise Architect and I need to import some relationships (of already existing elements) that I have in an Excel. I tried running a JScript but wasn't able to run it (haven't still figured out why).
How can I import a massive amount of relationship into my model?
Thanks in advance.
My Script is:
!INC Local Scripts.EAConstants-JScript
var connectorArray = new Array(
['{870632BA-154F-4564-AD51-C508C1A7E537}','{4B291196-7B4B-490b-B51D-04B9925CAA2A}','Dependency','','RME1']
);
function main()
{
var source as EA.Element;
var target as EA.Element;
var connector as EA.Connector;
var sourceGUID,targetGUID,type,stereotype,alias;
for(var i = 0; i < connectorArray.length; i++) {
sourceGUID = connectorArray[i][0];
targetGUID = connectorArray[i][1];
type = connectorArray[i][2];
stereotype = connectorArray[i][3];
alias = connectorArray[i][4];
source = Repository.GetElementByGuid(sourceGUID);
target = Repository.GetElementByGuid(targetGUID);
Session.Output("Processing connector: " + alias);
if(source != null && target != null) {
connector = source.Connectors.AddNew("",type);
if(stereotype != "") {
connector.Stereotype = stereotype;
}
connector.SupplierID = target.ElementID;
connector.Alias = alias;
connector.Update();
}
source.Connectors.Refresh();
}
Session.Output("END OF SCRIPT");
}
main();
My errors are:
[423447640] Hilo de registro de pila establecido para marcos 3
[423447879] Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[423447879] Agent dll found: C:\Program Files (x86)\Sparx Systems\EA\vea\x86\SSScriptAgent32.DLL
[423447879] Default Directory is C:\Program Files (x86)\Sparx Systems\EA
[423447879] Agent: Started
[423447967] Microsoft Process Debug Manager creation Failed: 0x80040154
[423447967] This is included as part of various Microsoft products.
[423447967] Download the Microsoft Script Debugger to install it.
[423447967] Failed to initialize JScript engine
[423447967] Sesión de depuración terminada
Thanks again.
Well, may be I'm wrong, but you can see the error Download the Microsoft Script Debugger to install it. I guess, that you're trying to run the script "Debug" button instead of "Run script".
If you want to debug your scrtipt, you"ll must to install any Microsoft product that contains debagger. Microsoft Script Debugger.
FYI Did you try the Excel Import \ Export feature of Sparx Systems in MDG Office Integration .
You can create \ update \ Synchronise model elements, connectors and other details inside enterprise architect in a single click.

Auto fill some fields in form when you found id of other form, odoo 8.0

I try to create a simple function who try to fill specific fields in own form when I select the ID of patient registered in other form/module. I put an example:
Module Registro:
(create patient)
(automatic generation ID and visible)
-Nombre:
-Email:
-Teléfono:
(save)
Admisión module:
(Open new form)
-ID: select id
(function for auto fill the next fields)
-Nombre: nombre (registro)
-Email: email(registro)
-Teléfono: teléfono(registro)
Use the new API Odoo 8.0 I try this, but doesn't work with message: error 500 type.
función autocompletar campos
#api.onchange('telefono_contacto','persona_contacto','email','nombre_acompanante') # mete campos a afectar
def autofill(self):
# comdición; si esta con el id seleccionado
# self.id_anamnesis
# llenar los campos con los correspondientes del id
# self.telefono_contacto =''
# self.persona_contacto = ''
# self.email = ''
# self.nombre_acompanante = ''
pass # aquí la lógica
(La plataforma es Odoo 8.0, S.O: Ubuntu 14.04)
Thank you and best reegards,
Marco García Baturan.
product_id = fields.Many2one("myproduct.model",string="Product", required=True)
description = fields.Char("Description", related="product_id.description", store=True)
It is done using related="......"
What I have done is When I select my product it will automatically
set description of that particular product.
So you need to add related where you want to auto fill.
If you set store=True then description is store into database.

Capybara failing with ionic app

I'm doing integration tests with Capybara on a Ionic app that use rails in backend, and I'm having a problem after I signin successfully, the second visit does nothing and I have a timeout while waiting for angular.
# test_helper.rb
Dir[Rails.root.join("test/helpers/**/*.rb")].each { |f| require f }
require 'capybara/rails'
require 'capybara/poltergeist'
if ENV['VIEW_IN_BROWSER'] == "true"
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :firefox)
end
else
Capybara.javascript_driver = :poltergeist
end
Capybara.server_port = 3000 # serveur rails en mode test
Capybara.always_include_port = true
Capybara.default_max_wait_time = 5
Capybara.raise_server_errors = false
class ActionDispatch::IntegrationTest
# Make the Capybara DSL available in all integration tests
include Capybara::DSL
include Capybara::Angular::DSL
def setup
super
end
def teardown
super
Capybara.reset_sessions!
Capybara.use_default_driver
end
end
My helper :
#test/helpers/ionic_helper.rb
module IonicHelper
include Warden::Test::Helpers
Warden.test_mode!
def on_ionic_app
Capybara.app_host = 'http://localhost:5000' # Serveur ionic
begin
yield
rescue => error
puts error
ensure
Capybara.app_host = 'http://localhost:4321' # serveur ionic en mode intégration continue
end
end
def user_log_in
user = FactoryGirl.create(:user)
visit(Capybara.app_host+"/#/app/signin")
fill_in "email", with: user.email
fill_in "password", with: user.password
click_on "Connexion"
end
end
The first problem is that I have to specify Capybara.app_host to the visit mehod to hit the good ionic port (5000) I cannot figure why.
My second problem is is this test :
# reseau_test.rb
require "test_helper"
class ReseauTest < ActionDispatch::IntegrationTest
include IonicHelper
test "On s'assure que tous les elements en mode connecté soient présents" do
Capybara.current_driver = Capybara.javascript_driver
on_ionic_app do
user_log_in
visit(Capybara.app_host+"/#/app/network")
assert page.has_css?('span.count.following.text-center.ng-binding'), "Il doit y avoir un chiffre pour le nombre d'abonnements"
assert page.has_content?('Abonnements'), "Il doit y avoir le texte 'Abonnements'"
assert page.has_css?('span.count.follower.ng-binding'), "Il doit y avoir un chiffre pour le nombre d'abonnés"
assert page.has_content?('Abonnés'), "Il doit y avoir le texte 'Abonnés'"
end
end
end
If I remove user_log_in the tests work fine, but this page have to be seen with a logged user, and when I test it, it fails with timeout while waiting for angular. I can put the Capybara.default_max_wait_time to 30 it fails the same way.
First problem: The reason you're having issues with app_host is because you're specifying Capybara.always_include_port = true. What this does is force the port being visited to be set to the port Capybara is running a server on unless the address passed to visit has a non-default port specified. Since it doesn't look like you ever want visit to connect directly to the server being run by Capybara you should set remove it or set it to Capybara.always_include_port = false. With it false you can just set Capybara.app_host as needed and it should be used as the default start for visit
Your second issue is being caused by the JS capybara-angular is running in the page never showing the page as ready. Check for errors in your JS that could be preventing capybara-angular to have issues, or look at https://github.com/wrozka/capybara-angular/issues/20

ColdFusion and Unicode Characters Issues

Working on the Globalization of the Coldfusion website using the i18n.
I am using the resource files rather than database..
In my one of the string files, i have the value being displayed as:
Inicia sesión con tu nombre de usuario y contraseña.
and when i run on my browser, it is displayed as:
Inicia sesi�n con tu nombre de usuario y contrase�a.
Having read the below link, i have enabled the utf through cfprocessingdirective and the meta tag also, but i am not sure why it is still displaying it like this.
ColdFusion character encoding issue
I used the Google translate to translate the above English to Spanish.
Using this in my Application.cf also:
<cfset setLocale("English (US)")>
<!--- Set the session page encoding --->
<cfset setencoding("URL", "utf-8")>
<cfset setencoding("Form", "utf-8")>
Update #1
I cannot Update, but i am adding here:
spanish:
username=Nombre de usuario
login=Inicia sesión con tu nombre de usuario y contraseña.
appName=Inventory Manager
rem=Acuérdate de mí
slogin=Iniciar sesión
errorLoginMsg=Error! Credenciales de login fallidos, Inténtalo de nuevo
ser='Nombre de usuario' es un campo obligatorio.
ser1='Password' es un campo obligatorio.
nitem=Nuevo elemento
ilist=Lista de artículos
order=Orden
olist=Lista de Pedidos
sell=Vender
slist=Lista de Ventas
quote=Cotizaciones
qlist=Lista Cotizaciones
rs=Vuelto Vendido
inv=Factura
Russian File it is ru.rtf
username=Имя пользователя
login=Войти с именем пользователя и паролем.
appName=Inventory Manager
rem=Запомнить меня
slogin=войти
errorLoginMsg=Ошибка! Учетные данные для входа не удалась, попробуйте еще ​​раз
ser='Имя' является обязательным полем.
ser1=Поле 'Пароль' является обязательным.
nitem=Новый элемент
ilist=Список статей
order=Заказать
olist=Список Заказать
sell=Продать
slist=Список продажам
quote=Цитаты
qlist=Котировки Список
rs=Продано Возвращается
inv=Счет