..getHours is not a function - imacros

i have some trouble with imacros. It seems that it doesn't recognise getHours() or setHours() functions.
I'll post a bit of my code to show you what i'm trying to do:
var FormatData = new Date(D[0],D[1]-1,D[2],D[3],D[4],D[5],0);
var Data=FormatData;
Data.SetHours(Data.getHours() - Durata[0]);
After execution , i get this error: ".getHours is not a function, line 22 (Error code: -991)"
If it helps, i received the same kind of error for setTimeout() function. And i solved it by adding window.setTimeout().
I tried the same trick here, but still "window.getHours is not a function, line 22 (Error code: -991)"
If you have a solution for using .setHours in imacros , please repply.
Thank you in advance !

Could you please try this one?
Data.setHours(Data.getHours()- Durata[0]);

Related

ROS C++: nh.subscribe vs message_filters::Subscriber<> , nh.subscribe works well but message_filters::Subscriber<> does not work

I'm tring to learn ROS topic, but I met a problem that really confused me.
Here is the origin code. It works well, I can receive the image and pass it to CamImgcb.
mSubCam = mNh.subscribe<sensor_msgs::Image>(TopicNameCamSub,10,boost::bind(&ClientHandler::CamImgCb,this,_1));
But when I change it to this code below, CamImgcb can not receive anything, the whole program is stuck to wait for the image to come.
message_filters::Subscriber<sensor_msgs::Image> rgb_sub(mNh, TopicNameCamSub, 10);
rgb_sub.registerCallback(boost::bind(&ClientHandler::CamImgCb,this,_1));
My question is that aren't those two codes means the exact same thing? Why is there a difference between them? I just can't figure it out.
Does anyone know what is the problem? Please help me and thank you so much!
I had a similar issue a while back and found the solution here.
Try changing:
rgb_sub.registerCallback(boost::bind(&ClientHandler::CamImgCb,this,_1));
To:
rgb_sub.registerCallback(&ClientHandler::CamImgCb, this);
Solved it , the solution is here!
https://answers.ros.org/question/406915/nhsubscribe-works-but-message_filterssubscriber-not/

Call a function from within pdfMake in Ionic2?

I have the following pdfMake code block in my ionic app:
pdfMake.createPdf(docDefinition).getBase64(function (encodedString) {
pdfEncoded = encodedString;
console.log(pdfEncoded);
this.sendValue(pdfEncoded);
}
The error I am getting is:
Cannot read property 'sendValue' of undefined.
What do I need to do to call the sendValue() function? I am able to console.log the value of pdfEncoded but unable to pass the value to a function. Can someone let me know what I am doing wrong.
Thank you,
A
One reason of the error maybe because the keyword 'this' might be undefined inside your function(block). Check for that and see if the error is because of that and if it is try this :
let $this = this
And then inside your function use it as:
$this.sendValue(pdfEncoded);

"Expected Declaration" Error on Delegate Function Call

Xcode 8/Swift 3
Can anyone please tell me why I am getting this "expected declaration" error? The use of delegates answered my last question perfectly without getting this error.
Googling other "expected declaration" problems suggests function calls etc being in the wrong place but I don't think thats the case here - I have tried placing delegate?.loadFirstView(viewFromModel: firstView) in a separate function and then calling that function but I just get the same error. See the screenshot below:
Thanks in advance!
P.S: below is a screenshot of when my use of a delegate worked perfectly.
Third Screenshot with delegate call in a separate function:
You have the code (delegate?.loadFirstView(viewFromModel : firstView)) in the wrong place in the class. So move it to any function.
In your working screenshot, the code is written inside the updateClock()method, thus working without any error.
class modelClass{
var delegate : LoadFirstViewProtocol?
let firstView = "First view loaded"
func testing()//Write here user defined method named
{
delegate?.loadFirstView(viewFromModel: firstView)
}
}

Assert failed in OnInitDialog()

So I have an "assertion failed" error message when I want to run my program. I understand that it means that somewhere a condition that should be true isn't but I don't know how to correct that.
The error concerns the following line :
_AFXWIN_INLINE BOOL CEdit::SetReadOnly(BOOL bReadOnly)
{ ASSERT(::IsWindow(m_hind)); return (BOOL)::SendMessage(m_hWnd, EM_SETREADONLY, bReadOnly, 0L); }
So I get that it's about the "Read Only" condition, but I don't know where to correct that.
I am new in C++, so sorry if I forgot to put important information in my question.
Thanks in advance!
The OnInitDialog function contains a call to the base class function
CDialog::OnInitDialog();
Move your calls to SetReadOnly to after that line. The edit control variables are only initialized after that line.
Thank you for your help! Finally, after going through the whole code line by line, I realized in DoDataExchange I mixed up and put twice the same variable at some point instead of two different ones ... So I don't really know how that got me that error but I thought I'd keep you updated in case someone makes the same absent-minded mistake and gets that error :)

What has to be Glib::init()'ed in order to use Glib::wrap?

So I'm trying to make use of a GtkSourceView in C++ using GtkSourceViewmm, whose documentation and level of support give me the impression that it hasn't been very carefully looked at in a long time. But I'm always an optimist :)
I'm trying to add a SourceView using some code similar to the following:
Glib::RefPtr<gtksourceview::SourceLanguageManager> source_language_manager = gtksourceview::SourceLanguageManager::create();
Glib::RefPtr<gtksourceview::SourceLanguage> source_language = Glib::wrap(gtk_source_language_manager_guess_language(source_language_manager->gobj(), file, NULL));
Glib::RefPtr<gtksourceview::SourceBuffer> source_buffer = gtksourceview::SourceBuffer::create(source_language);
gtksourceview::SourceView* = m_source_view = new gtksourceview::SourceView(source_buffer);
m_vbox.pack_start(*m_source_view);
Unfortunately, it spits out the warning
(algoviz:4992): glibmm-WARNING **:
Failed to wrap object of type
'GtkSourceLanguage'. Hint: this error
is commonly caused by failing to call
a library init() function.
and when I look at it in a debugger, indeed the second line above (the one with the Glib::wrap()) is returning NULL. I have no idea why this is, but I tried to heed the warning by adding Glib::init() to the begining of the program, but that didn't seem to help at all either.
I've tried Google'ing around, but have been unsuccessful. Does anyone know what Glib wants me to init in order to be able to make that wrap call? Or, even better, does anyone know of any working sample code that uses GtkSourceViewmm (not just regular GtkSourceView)? I haven't been able to find any actual sample code, not even on Google Code Search.
Thanks!
It turns out, perhaps not surprisingly, that what I needed to init was:
gtksourceview::init();
After this, I ran into another problem with one of the parameter to gtksourceview::SourceLanguageManager, but this was caused by a genuine bug which I subsequently reported and was promptly fixed. So everything's working great now!
I use gtkmm. Typically you have to initialize things with something like :
_GTKMain = new Gtk::Main(0, 0, false);
Of course do not forget :
delete _GTKMain;
Check here for details :
http://library.gnome.org/devel/gtkmm/2.19/classGtk_1_1Main.html
(Sorry but the link option does not work ...)