How to use the standard error message - lemoon

I can't seem to find out how to use the standard "slide in from top" error in Lemoon CMS. Anyone tackled this problem before? I'm trying to use the error for my own login module.

You should call SetMessage(string message, string type, int duration) from your code behind. The SetMessage method is defined in the Lemoon.Web.UI.Admin.PageBase class. That means it will probably not work on the public part of your site, only from the admin section.

Related

Calling Xamarin.Android Interop from Xamarin.UITest

I've created a method in the first Activity of my app which I have added the Java.Interop.Export tag to, as below.
[Export]
public string MyInvokeMethod(string myString)
{
_webview.LoadUrl("http://www.google.co.uk");
return "test";
}
And I'm trying to call this method in Xamarin.UITest with the below.
app.Invoke("MyInvokeMethod","test");
However, nothing seems to happen. I looked into the logs of the Android device and it seems as though it is trying to call the method but it gets below error.
"Method not found with correct argument types. Trying to type convert."
Is there a way to get this to work? I have tried with passing an argument, without passing an argument, adding a name for the method in the attribute but nothing has worked.
EDIT
After speaking to one of the Xamarin developers they believe it might be an issue with how MvvmCross handles the Android Activity.
I think you should add
[Export("myInvokeMethod:")]
on top of your method, instead of only add [Export]
Someone using xamarin uitests might find this useful too: https://forums.xamarin.com/discussion/57662/xamarin-forms-uitest

Why does a "on a non-object" error occurs with this extension in Magento?

I'm having an Issue with a blog extension in Magento CE 1.6.2.0.
I installed this extension: Neotheme_nBlog.
I created an entry in the administrator.
Then I went to http://www.example.com/index.php/blog/ to see the recently created entry.
What I saw was an error like this:
Fatal error: Call to a member function getName() on a non-object
in /home/example.com/public_html/app/design/frontend/default/caramel/template/magicat/left.phtml
I searched in google the terms: "template/magicat/left.phtml" getName and what I only found is sites having this issue, but no support at all.
Please note: I know what does that error mean in PHP ("unfortunately" I'm not new at that). What I don't understand is what's happening with such [NON/null] object and how to fix it without killing a dozen of kittens.
Question: What can I do to solve it? What is the nature of the error, regarding Magento?(again: not PHP).
Notes: The Magento site (http://magento.stackexchange.com) is somewhat poor and strict to bring support of such nature, so asking there is not an option.
Edit (as answer to comment, and to clarify):
Neotheme is still not responding the request.
Don't know what should I look on such file (instances are not initialized there, but only accessed).
I'm using the default theme (caramel), which has esthetical changes (does not have layout changes).
It's hard to say without seeing your system specifically, but on this
template/magicat/left.phtml
It looks like you've added a template named magicat/left.phtml to your system -- either via an extension or custom development. Somewhere in this file PHP's called getName on a non-object. There's a variety of reasons this could be happening, and without seeing the specific line of code PHP's complaining about in your system, it's hard to say. It'd also be helpful to know if magicat is part of the extension or something else.
The most common reason for this error in a template is code that relies on a block being there that's been removed by another extension (eitehr via layout XML or observer methods)
$this->getLayout()->getBlock('some_block')->getName();
The next most common is people using the registry to communicate between templates and views, but a registry key not being set
Mage::registry('some_item')->getName();
Without knowing the variable and context, it's doubtful anyone will be able to help you.

Creating the first web page via brew

When a use accesses my application, I want to return a web page that I construct using brew. Right now I have an init() - this is the function that the user specifies. The function executes brew and creates a web page. It then returns the file name of the web page.
When I attempt the following ../library/xbrowser/R/init/file I get the following error reported to the browser:
cannot coerce type 'closure' to vector of type 'character'
In call:
as.character(x)
The documentation indicates that I could use the /file output as a means to create and return a web page. Am I using this feature incorrectly? Is there a better way to create and return a web page?
OK, I think my problem is an operator error.
I should have been testing the function with POST instead of GET which is, of course, the method used when you use a browser.
I don't get this message if I POST with curl - for instance.
My apologies for wasting anyone's time.
Peter
One more observation: don't use init as a function name; it seems to use some other namespace and complains about lazy-loading a database named 'P'

Selenium Webdriver/TestNG/Maven/Xvfb - take screenshot on fail?

wanted to ask you about the best way to take screenshot on fail in such project?
Should I do it in the Selenium code, or in the Maven project via some command or with Xvfb?
Im using Firefox headless via Xvfb.
I have seen a few classes on the internet that take screenshots, but Im missing the big picture here.
How does this class know when to take the screenshot?
How does Jenkins tell the java test code that it has failed, so it will take a picture?
Where in the test code should I reference the take screenshot class?
Should I use a try catch on the whole test?
Isnt there a Jenkins plugin that will automatically save screenshot on fail?
I just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
How does it work?
Effectively, you pass in a custom WebDriverEventListener, which has functions that will be called on certain events. One of those events is onException(). So every time an exception is thrown by WebDriver, you can write the code to take a screenshot.
I have seen three different ways to do this:
If you have a static driver, the easiest way is to set up a listener in TestNG (Overridding TestListenerAdapter), and then to take a screenshot in the onTestFailure() method.
My personal method is to use the Selenium Page Object pattern, but modified a bit. I have created an EnhancedWebElement object that wraps and extends a normal WebElement, and has a reference to the driver. Then in each of the methods that WebElement has, I perform the call in a try/catch and in the catch, I then take a screenshot. I'm open to sharing the code, but I'd have to trim away quite a bit to post here, so please tell me if you want to see it.
Alternatively, you can set up a proxy around the WebElement or the Driver itself and have it catch everything. I haven't done this, but I've seen it work on other projects.
just found an article that explains a much better way to do it: http://darrellgrainger.blogspot.com/2011/02/generating-screen-capture-on-exception.html
Blockquote
But this dicision have some problem. it will save screenshoot on any exception even when you try/catch some in your code.
I use methods from that article. But in my testng.xml files i add
`
<listeners>
<listener class-name="MyListener" />
</listeners>
`
And than i create
`
public class MyListener implements ITestListener{
//almost all methods i create blank
//but implement only onTestFailure
//
onTestFailure(){
//here i used methods from article ubove
//
}
}
`
And screenshots done only in case when my #Test fail.

Creating an email using templates and then attaching dynamic attachments

I have been trying to write some custom workflows for our org but I am stuck on a particular issue. I know how to create attachments and link them to a new email, but I want to do the same with templates? I understand how to use the SendEmailFromTemplateRequest class, but I haven't found a way to link attachments to it. I found this article
but I need more detail on how to use the InstantiateTemplateRequest. I've tried to tinker with it using this as a guide but so far I've not had luck.
My needs are that I need to create an email from a template and then attach files to it that are dynamically generated.
I found what I needed here, but I noticed that I still needed to Create the email object using the IOrganizationService helper. Basically I created the InstantiateTemplateRequest, thend passed it into the IOrganizationService Execute() function and then retrieved the Email object from the InstantiateTemplateResponse object. After I had the Email I then edited and passed it into the IOrganizationService Create() function. After that I sent it along using a SendEmailRequest object which also needs a IOrganizationService Execute() call.
I am not very sure about how you are actually going to use the templates. But one work around could be that you can send the email in the same way you send with attachments. Create some logic to get the string content of the template, perform string handling operations as per requirement(Usually there are only a few fields in template that are to be modified and most of the text remains same). Now pass this string to the body of the email as string. I dont think there should be any trouble in this. Please correct me if I am missing some thing or misunderstood the complete question.

Resources