Calabash not considering changes to the core files - calabash

The screenshots taken by Calabash has numbers appeneded at the end to make it unique. I am looking to remove this and just want the filename without these auto generated number.
As mentioend in the question at
CALABASH - Renaming screenshot filenames without the iterator , I have edited code in lib/calabash-cucumber/failure_helpers.rb but it's of no help.
Any changes done to the core files are not getting reflected.
I am trying for Android.

def screenshot(options={:prefix => nil, :name => nil})
screenshot method in failure helpers has path variable appended with screen shot count path = "#{prefix}#{name}_#{##screenshot_count}.png"
remove screenshot count and that must work path = "#{prefix}#{name}.png"

Related

Using substitution string for dynamic filename for download in interactive grid

I want to set the filename for download of an interactve grid (Application Express 5.1.0.00.45) dynamically to a combination of a timestamp and the page alias.
What I've already done:
step: As mentioned in http://oraclequirks.blogspot.com/2008/02/build-and-use-apex-page-alias.html I've built a application item to get a substitution string for the page alias. => Works fine!
step: As mentioned in APEX dynamically define default filename? I've generated a page item (P510_FILENAME) which shows the filename I would like to use. => Works fine!
step: To use the content of this page item P510_FILENAME as filename I've set Report Attributes > Report Export > Filename to &P510_FILENAME.. => But when I try to download the interactive grid, it shows &p510_filename..csv_ as filename!
So I have to problems:
The substitution string doesn't get replaced by the content of the page item P510_FILENAME. Also if I directly use my application item &APP_PAGE_ALIAS.it doesn't get replaced. But the (at the moment not hidden) page item P510_FILENAME shows the correct filename.
The file extension is set to '.csv_' instead of '.csv'. All the same when I try to download a HTML file.
Any ideas?
For &. type substitution string should be all caps.
In this name &p510_filename..csv_ it looks like it was entered in lower case. Please try with the exact(case sensitive) name.
Ex:
Late answer for anyone seeing it in the future:
when using substitution string for downloading a file of a table, you need to submit that item in the table region:
and then you can this item in the attributes.

load data into power BI from relative path

I am trying to find a solution to load an external data file but from a relative path, so when someone else open my PBIX it will still work on his/her computer.
many thanks.
Relative paths are *not* currently supported by Power BI.
To ease the pain, you can create a variable that contains the path where the files are located, and use that variable to determine the path of each table. That way, you only have to change a single place (that variable) and all the tables will automatically point to the new location.
Create a Blank Query, give it a name (e.g. dataFolderPath) and type in the path where your files are (e.g. C:\Users\augustoproiete\Desktop)
With the variable created, edit each of your tables in the Advanced Editor and concatenate your variable with the name of the file.
e.g. instead of "C:\Users\augustoproiete\Desktop\data.xlsx", change it to dataFolderPath & "\data.xlsx"
You can also vote/watch this feature request to be notified when it gets implemented:
Support relative path to excel/csv sources
You can use also the "Parameters" function.
1. Create a new Parameter like "PathExcelFiles"
Parameter_ScreenShot
Edit your "Source" entry
SourceEntry_ScreenShot
Done !
I don't think this is possible yet.
Please add your support for this idea so the Microsoft Power BI team will be more likely to add this as a new feature.
I couldn't bear the fact that there is no possibility to use relative paths, but finally I had to...
So I tried to find a half-decent acceptable workaround.
Using Python-Script it is at least possible to get access to the users %HOME% directory.
let
PySource = Python.Execute("from pathlib import Path#(lf)import pandas as pd#(lf)dataset = pd.DataFrame([[str(Path.home())]], columns = [1])"),
homeDir = Text.Trim(Lines.ToText(PySource{[Name="dataset"]}[Value][1])),
...
The same should be possible with R-Script but didn't do it.
Anybody knows any better solution to get the %HOME% directory inside "Power" Query? I would be glad to have one.
Then I created two scripts inside my working directory install.bat:
#ECHO OFF
if exist "%HOME%\.pbiTemplatePath\filepath.txt" GOTO :ERROR
#This is are the key commands
mkdir "%HOME%\.pbiTemplatePath"
echo|set /p="%cd%" > "%HOME%\.pbiTemplatePath\filepath.txt"
GOTO :END
#Just a little message box
:ERROR
SET msgboxTitle=There is already another working directory installed.
SET /p msgboxBody=<"%HOME%\.pbiTemplatePath\filepath.txt"
SET tmpmsgbox=%temp%\~tmpmsgbox.vbs
IF EXIST "%tmpmsgbox%" DEL /F /Q "%tmpmsgbox%"
ECHO msgbox "%msgboxBody%",0,"%msgboxTitle%">"%tmpmsgbox%"
WSCRIPT "%tmpmsgbox%"
:END
and uninstall_all.bat:
#ECHO OFF
if exist "%HOME%\.pbiTemplatePath\filepath.txt" RMDIR /S /Q "%HOME%\.pbiTemplatePath\"
So in "Power" BI I did this:
let
PySource = Python.Execute("from pathlib import Path#(lf)import pandas as pd#(lf)dataset = pd.DataFrame([[str(Path.home())]], columns = [1])"),
homeDir = Text.Trim(Lines.ToText(PySource{[Name="dataset"]}[Value][1])),
workingDirFile = Text.Combine({homeDir, ".PbiTemplatePath\filepath.txt"} , "\"),
workingDir = Text.Trim(Lines.ToText(Csv.Document(File.Contents(workingDirFile),[Delimiter=";", Columns=1, QuoteStyle=QuoteStyle.None])[Column1])),
...
Now if my git-repository (containing a "Power" BI-template-file and some config-files saying the template where to load the data from and the install/uninstall-scripts). Install has to be executed once and nobody has to copy and paste any path.
I'd be glad about any suggestion of improvement. It's not the solution Gotham deserves... Gotham deserves a better one.
As mentioned by a few people, you can use a dataset parameter and reference that in your script. What I haven't seen mentioned is that you can change these values using an API call:
https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-parameters

Extracting Outlook Attachment from Saved Email

I have an analysis project that is requiring me to extract the 'current state' of a PDF that houses our report that is sent out 4 times daily. I have the code written to scrape my PDF but I need to figure out how to extract the PDF from the email so I can step through it with my code.
I tried using the code below
import win32com.client
import os
location = r'C:\Users\myusername\OneDrive - companyinfo\Department Projects\TestEmails'
files = [f for f in os.listdir(location)]
print(files)
for file in files:
if file.endswith('.msg'):
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
msg = outlook.OpenSharedItem(file)
att = msg.Attachments
for i in att:
i.SaveAsFil`e(os.path.join(r'C:\Users\username\OneDrive - companyname\Department Projects\TestPDF', i.FileName))
The error it produces is:
pywintypes.com_error: (-2147352567, 'Exception occurred.', (4096, u'Microsoft Outlook', u"We can't open 'Stats Report.msg'. It's possible the file is already open, or you don't have permission to open it.\n\nTo check your permissions, right-click the file folder, then click Properties.", None, 0, -2147287038), None)
I am only currently testing with one saved test.msg file but I have over 1400 I need to parse through. Maybe this isn't the best technique as I know VBA could do something similar within outlook, but I don't have much skills in the VBA region.
I have outlook 2016 installed on Windows 7 computer running python 2.7. Is this error something easy to fix? Is there a better technique to take an attached PDF and save it to a folder so my other program can grab the necessary data?
Desired output: PDF Attachment is Extracted and Saved into a separate folder.
Thank you for your help and expertise,
Andy
So I figured out the answer and how simple and stupid it was makes me unreasonably frustrated.....
My working directory was wrong even though I grabbed the file, the file name was the only item created.
I created a true_location variable that gave it the true full working directory and it worked like a charm.
true_location = location + '\\' + file
Enter that in the for loop under the if clause and it works like a charm.
Best,
Andy

C++ Windows API DlgDirList sometimes don't return the correct listing

I have 2 List Box, one always listing directories from a path and other listing the files from the selected directory.
The first time i select a directory, the files are shown properly, but if i select another directory, it lists nothing.
That's my current main.cpp, where all GUI stuff happens: http://pastebin.com/PjSb8aKy
List Box codes goes from lines 31 to 45 and 150 to 165.
Thanks in advance.
--------------------------------------------------EDIT---------------------------------------------------------------
I put a simple std::cout on the sel string, the result is that on the first directory i select, it's "", then it becomes "DirectoryName\", i tried changing the sel string to be "./DirectoryName", didn't managed to do it, the "\" still appears, but that isn't what bothers me, the real weird stuff is the first selection returning "" to the sel string...
I think the clue is in the docs for the DlgDirList function:
If lpPathSpec specifies a directory, DlgDirListComboBox changes the
current directory to the specified directory before filling the list
box.
I've never used these functions myself but I'd bet that your current directory is being modified and so subsequent calls to DlgDirList are looking in the wrong place.

Django and tinymcs: getting list of image files using external_image_list_url

I am trying to get external_image_list_url to work with tinymcs and Django. My understanding is that the user will be able to see a list of his or her images when clicking on the image icon (the one with the tree). From here an image can be selected and inserted.
Am I right that it is the icon with the tree? It's the one called "image". The one called "insertimage" doesn't work at all - the icon is not displayed. It and insertfile are the only ones that aren't displayed. I'm Ok with that unless I need it for this list functionality.
First I am trying just to get any image to appear in a list. I have done the following:
Created myexternallist.js and placed it where I keep my other JS files. I can access these other files via src = "/media/js/filename.js" because of my django settings. But is this also what I should put for:
tinyMCE.init({
external_image_list_url : "/media/js/myexternallist.js",
... })
In this file it says:
var tinyMCEImageList = new Array(["Logo 1", "/media/js/photo.jpg"],);
photo.jpg is in the same folder as myexternallist.js
I have also tried just "photo.jpg" and various other combinations. Not sure if my issue has to do with my relative paths or something else altogether. I'm not sure what an absolute path should be. Right now I'm working on localhost, but won't always be.
Solved it, argh. The issue was the comma near the end of the line "var tinyMCEImageList =..."
Now it works fine with the relative urls starting with /media
The clue was given by Firebug Console, which showed me the js error. I just happened to click there, but will be using that a lot from now on!