Sorry for Google translator...
Hello!
I want to understand the use of the Swift RSBarcodes library.
How to assign a variable scanned code.
I tried to do so:
var MyVar:String = ""
self.barcodesHandler = { barcodes in
for barcode in barcodes {
MyVar = barcode.stringValue
}
}
But this has no effect :(
How to generate code?
I tried to do so:
RSUnifiedCodeGenerator.shared.generateCode("2166529V", machineReadableCodeObjectType: AVMetadataObjectTypeCode39Code)
But this has no effect :( What should I do to see the generated image. I do not understand.
Maybe someone has a full description of the library or working example.
I would be very grateful.
Sorry for Google translator...
Related
I'm trying to use dataTaskDidReceiveResponse of the SessionDelegateof the manager but can't find how to use it. I'm new to swift (but experienced with objective-c) and can't found the correct syntax.
I have tried something like
manager.delegate.dataTaskDidReceiveResponse = {
return NSURLSessionResponseDisposition.Allow
}((session:NSURLSession, task:NSURLSessionDataTask, response:NSURLResponse)-> NSURLSessionResponseDisposition)
and some other variants. I don't know if it's just a syntax issue or my comprehension of swift/Alamofire that is lacking.
Can anyone help me found the right path?
Thanks.
Found it:
manager.delegate.dataTaskDidReceiveResponse =
{(session:NSURLSession, dataTask:NSURLSessionDataTask, response:NSURLResponse) -> NSURLSessionResponseDisposition in
return NSURLSessionResponseDisposition.Allow
}
I want to open a new tab with a gloda conversation from inside calendar code.
I receive an error from error console:
window not defined (or document not defined), depending on which of the two I use to Access tabmail:
let tabmail = window.document.getElementById("tabmail");
let tabmail = document.getElementById("tabmail");
The code works fine if the js file is included in an overlay xul-file.
But I want to use it outside of xul in my code.
Somewhere in my calendar code (in my 'addevent'), the same code throws the error.
This code is originally called from a rightclick on an email, but several layers deep into calendar code.
In MDN, I read that window is global? So what do I Need to do to add an tab?
This part works if tabmail is properly referenced:
tabmail.openTab("glodaList", {
collection: queryCollection,
message: aCollection.items[0],
title: tabTitle,
background: false
});
So how do I get a reference for tabmail?
Any help is appreciated.
after trying and looking through code for really some time before posting, it took only ca. 20 minutes to accidentally find the solution after submitting the question..
While browsing mailutils on mxr for something else, I found the solution in some function:
mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
if (mail3PaneWindow) var tabmail = mail3PaneWindow.document.getElementById("tabmail");
Has anyone succeeded in using Protractor to detect an ionicPopup alert?
I've tried all the workarounds suggested here but no luck.
I need Protractor to detect the alert and check the text in the alert.
Here's the class I wrote to test that the popup exists and to ensure the text is correct in the header and body:
var TestUtilities = function(){
this.popup = element(by.css('.popup-container.popup-showing.active'));
//Tests to see if $ionicPopup.alert exists
this.popupShouldExist = function() {
expect(this.popup.isDisplayed()).toBeTruthy();
};
//Tests to see if $ionicPopup.alert contains the text provided in the argument exists in the header
this.popupContainsHeaderText = function (text) {
this.popupShouldExist();
expect(this.popup.element(by.css('.popup-head')).getText()).toMatch(text);
};
//Tests to see if $ionicPopup.alert contains the text provided in the argument exists in the body
this.popupContainsText = function (text) {
this.popupShouldExist();
expect(this.popup.element(by.css('.popup-body')).getText()).toMatch(text);
};
};
module.exports=TestUtilities;
Also check out this site for more on testing Ionic in protractor it talks about how to check to see if the popup exists: http://gonehybrid.com/how-to-write-automated-tests-for-your-ionic-app-part-3/
I've tested Ionic popups successfully by setting the popup variable as follows:
var popup = element(by.css('.popup-container.popup-showing.active'));
And in the test:
expect(popup.isDisplayed()).toBeTruthy();
Ionic Popups are just made of DOM elements, so you should be able to use normal locators to find/test them. Because they're not made of alerts, the workarounds in the issue you linked to are probably not useful.
I got it - I saw a lot of issues out there trying to do it in very complex ways, but in the end I tried this and it turns out to be this simple.
Inspect your element and find its ng-repeat value, then
var button = element(by.repeater('button in buttons')).getText()
You also need to have the browser sit out somehow for a couple seconds so it doesn't resolve to the tests while the ionic popup isn't actually there.
For that, browser.sleep(3000);
That's it! However, getting the other button in there is proving to be a little problem. var button = element(by.repeater('button in buttons')).get(0) or .get(1) return undefined is not a function.
Please accept the answer if you like it! If I figure out how to get the other button, I'll post it here.
I am trying to keep track of the current Y position on a PDF page created using FPDF so that I can correctly start a new page ensuring tables do not cross a page break. Firstly am I right in using GetY to monitor this and if so what is the correct syntax. I am trying
$currentYposition = GetY();
but it does not seem to work. Any advice?
No idea why this works - but it does:
If you just grab Y after the call, it seems to be the value before the MultiCell.
Grabbing it before and after and taking the difference gives you the height.
$oldY = $this->getY();
$this->MultiCell(150, 4, utf8_decode($description), 0, "L");
$newY = $this->getY();
$multiCellHeight = $newY-$oldY;
This one worked for me.
$y = $pdf->GetY();
I came to this question when programming in python and using the fpdf module. I'll post in case anyone else need this, I could not find this solution in the official documentation but for me following worked:
from fpdf import FPDF
pdf = FPDF()
pdf.add_page()
current_y = FPDF.get_y(pdf)
I'm trying to add a search field to my web site (ASP.NET MVC 2) and was told it'd be a good idea to use Nhibernate.Search, seeing that I was already using Nhibernate in the rest of the project.
Anyway, I followed a coulpe tutorials, namely this one, and some questions and answeres on this site, but in the end, it does not build an index, and searches come empty.
I know this question might be a bit vague, but it seems strange that nothing works even after I've done everything I was told.
Well, almost everything. At some point, in one of the tutorials, it tells me to type:
using (IFullTextSession s = Search.CreateFullTextSession(sf.OpenSession(new SearchInterceptor()))) {
QueryParser qp = new QueryParser("id", new StopAnalyzer());
IQuery NHQuery = s.CreateFullTextQuery(qp.Parse("Summary:series"), typeof(Book));
IList result = NHQuery.List();
Debug.Assert(result.Count == 2);
}
wich does not work because SearchInterceptor does not exist anywhere...
Am I missing something here?
Is there a way to better write the search queries?
In which part of my application does it build the index?
Thanks in advance.
I've tried something like:
public bool LuceneIndexAllVideos()
{
var s = NHibernate.Search.Search.CreateFullTextSession(Session);
foreach (Video video in Videos)
{
s.Index(video);
}
return true;
}
But is slow, but it seems to work nice...
See:
https://stackoverflow.com/questions/6989125/lucene-net-nhibernate-updating-lucene-index-from-existing-data