What are the minimum capabilities for Application Insights to work? - windows-phone

I'm trying to get Application Insights added to an existing project, which only flags the following as capabilities:
<Capability Name="ID_CAP_LOCATION" />
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_PHONEDIALER" />
<Capability Name="ID_CAP_MAP" />
I've added the call in my App's constructor to:
WindowsAppInitializer.InitializeAsync();
And of course, I've checked the ApplicationInsights.config file to check the InstrumentationKey matches that shown on my portal.
Do I need to add additional capabilities to allow these to work, as I'm not seeing anything show up on the Azure Portal for the subscription, and I'm not seeing anything in the debug output to suggest that any diagnostics are being attempted to be sent?

The only required capability appears to be ID_CAP_NETWORKING.
One other thing to watch out for; when using the UI to associate with your applciation insights it will add include a schema in the applicationInsights.config file, which stops it working.
So, instead of:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights>
<InstrumentationKey xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</InstrumentationKey>
</ApplicationInsights>
It should look more like:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights>
<InstrumentationKey>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</InstrumentationKey>
</ApplicationInsights>

Related

Integration of cloud hub with on premise splunk

In one of the requirement i want to integrate splunk with existing mule esb server that we are using(we are using cloudhub).
How can we achieve that?
Any help will be great.
You can use the Splunk connector to integrate within your applications. If you want to just send event data from existing applications see this other documentation page: Sending Data from Runtime Manager to External Monitoring Software
Add below configuration in your log4j file.
<Configuration packages="com.mulesoft.ch.logging.appender,com.splunk.logging">
<Http name="SPLUNK" url="https://input-prd-p-3ppsrv6qrg3h.cloud.splunk.com:8088" token="19954BDA-7A21-4FFA-A1E5-B3DFB7C75D55" disableCertificateValidation="true">
<PatternLayout pattern="%m" />
</Http>
where you should prefix "input-" to the domain name you have for splunk & the token will be the one that of http even collector.
Also while logging give reference of above http splunk appender :
<Root level="INFO">
<AppenderRef ref="SPLUNK" />
</Root>
Let me know if it works

Removing Custom Permissions/Actions from a Portlet

I have been able to define custom portlet actions/permissions based on this example in Liferay Plugins SDK
https://github.com/liferay/liferay-plugins/tree/master/portlets/sample-permissions-portlet
I want to know the necessary steps I need to take to remove the custom portlet actions/permissions (not model permissions) from a portlet.
I remember observing that when I re-deploy a portlet with modified custom actions/permissions, the old custom actions/permissions stick around.
I tried deleting the portlet folder from Tomcat's webapps and it was successfully unregistered. But after I deploy the portlet again with the custom actions/permissions removed from the corresponding XML, I can still see the permissions in the Define Permissions of a Role.
I tried clearing permissions setting in Server Administration of Liferay's control panel, but it didn't change anything (it wasn't supposed to).
After re-deploying the portlet with the removed/modified permissions and restarting the server, I still see the custom actions/permissions assigned to the portlet, but when I select the portlet, then I don't see the removed permissions which is what I need.
Does un-deploying a portlet remove all the associated custom actions/permissions from Liferay Portal and the portal's Database?
Or do I need to make separate liferay service calls to do that?
Any inputs in this regard are really appreciated.
Liferay Version: 6.1.2 CE GA3
portlet.properties
include-and-override=portlet-ext.properties
language.bundle=content.Language
resource.actions.configs=resource-actions/default.xml
resource-actions/default.xml
<?xml version="1.0"?>
<!DOCTYPE resource-action-mapping PUBLIC "-//Liferay//DTD Resource Action Mapping 6.2.0//EN" "http://www.liferay.com/dtd/liferay-resource-action-mapping_6_2_0.dtd">
<resource-action-mapping>
<portlet-resource>
<portlet-name>1</portlet-name>
<permissions>
<supports>
<action-key>ADD_SOMETHING</action-key>
<action-key>CONFIGURATION</action-key>
<action-key>VIEW</action-key>
</supports>
<site-member-defaults>
<action-key>VIEW</action-key>
</site-member-defaults>
<guest-defaults>
<action-key>VIEW</action-key>
</guest-defaults>
<guest-unsupported />
</permissions>
</portlet-resource>
</resource-action-mapping>
content/language.properties
action.ADD_SOMETHING=Add Something
portlet.xml
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
<portlet-name>1</portlet-name>
<display-name>Sample Permissions</display-name>
<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
<init-param>
<name>view-template</name>
<value>/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<resource-bundle>content.Language</resource-bundle>
<portlet-info>
<title>Sample Permissions</title>
<short-title>Sample Permissions</short-title>
<keywords>Sample Permissions</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>
liferay-portlet.xml
<liferay-portlet-app>
<portlet>
<portlet-name>1</portlet-name>
<instanceable>true</instanceable>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>
liferay-display.xml
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
<display>
<category name="category.sample">
<portlet id="1" />
</category>
</display>
liferay-plugin-package.properties
name=Sample Permissions
module-group-id=liferay
module-incremental-version=1
tags=sample
short-description=This plugin shows how to use the permission service from a portlet.
long-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.2.0+
portal-dependency-jars=\
jstl-api.jar,\
jstl-impl.jar
portal-dependency-tlds=\
c.tld
web.xml
<?xml version="1.0"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
The above code works perfectly and I am able to see the permissions in Define Permissions for role.
What I am looking for is, if I modify ADD_SOMETHING action to ADD_SOMETHING_ELSE or
Remove ADD_SOMETHING action and add a new action key MY_NEW_ACTION,
would the ADD_SOMETHING permission be removed completely from the portal? And if not what are the steps that I need to take to remove the ADD_SOMETHING permission?
Redeploy and Restart the server is enough to ensure these actions?
EDIT:
Based on Prakash's Response
//Ashok - Beanshell Script for ResourceAction Table Service
import com.liferay.portal.model.ResourceAction;
import com.liferay.portal.service.ResourceActionLocalServiceUtil;
import java.util.List;
List resourceList=ResourceActionLocalServiceUtil.getResourceActions(com.liferay.portal.kernel.dao.orm.QueryUtil.ALL_POS, com.liferay.portal.kernel.dao.orm.QueryUtil.ALL_POS);
for (ResourceAction resourceAction:resourceList) {
System.out.println("Resource Name: " + resourceAction.getActionId());
System.out.println("Resource Name: " + resourceAction.getName());
//ResourceActionLocalServiceUtil.deleteResourceAction(giveActionIdHereForDeleting);
}
Permissions are not removed from database for the portlet either when you un-deploy the portlet, or when you restart the server. why?
Because, undeploying a portlet does not necessarily mean the data needs to be removed from the database, the portlet can be redeployed many times. So liferay correctly takes the safe route of keeping the data intact unless it is manually deleted through the database or through some service. And the permissions are considered as data just like you have data stored for your custom asset.
So you can delete the permissions from ResourceAction table by creating some service or through the beanshell scripting panel in control Panel → Server Administration → Scripting → Select Beanshell. You would also need to take care of the bitwiseValue and the permissions already set in the ResourcePermission table.
I would suggest renaming the permission in the ResourceAction table rather than deleting and adding new, it might get complicated.
Hope this helps.

gmail contextual gadget does not show

I'm trying to build a gmail contextual gadget.
I had it working in the past but i must of changed something and it does not work now.
I have created the listing successfully and added the gadget to a test domain of mine.
But still nothing happens when i open up an email.
this is the manifest:
<?xml version="1.0" encoding="UTF-8" ?>
<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
<Support>
<Link rel="manage" href="http://example.com" />
<Link rel="support" href="http://example.com" />
<Link rel="deletion-policy" href="http://example.com" />
</Support>
<Name>Clarizen</Name>
<Description>Integrate with clarizen</Description>
<Extension id="navLink" type="link">
<Name>Clarizen</Name>
<Url>http://example.com</Url>
</Extension>
<!-- EXTRACTOR -->
<Extension id="Ex1" type="contextExtractor">
<Name>Ex1</Name>
<Url>google.com:EmailBodyExtractor</Url>
<Triggers ref="gadget1"/>
<Scope ref="emailBody"/>
<Container name="mail"/>
</Extension>
<!-- EXTRACTOR -->
<Extension id="Ex2" type="contextExtractor">
<Name>Ex2</Name>
<Url>google.com:SubjectExtractor</Url>
<Triggers ref="gadget1"/>
<Scope ref="emailSubject"/>
<Container name="mail"/>
</Extension>
<!-- GADGET -->
<Extension id="gadget1" type="gadget">
<Name>Clarizen contextual gadget</Name>
<Url>http://example.com:2057/test.xml</Url>
<Container name="mail"/>
<!-- Uncomment this to enable Caja. -->
<!-- <Param name="caja" value="enabled"/> -->
</Extension>
<!-- SCOPE -->
<Scope id="emailSubject">
<Url>tag:google.com,2010:auth/contextual/extractor/SUBJECT</Url>
<Reason>integaret with clarizen</Reason>
</Scope>
<Scope id="emailBody">
<Url>tag:google.com,2010:auth/contextual/extractor/BODY</Url>
<Reason>integaret with clarizen</Reason>
</Scope>
</ApplicationManifest>
I am able to load http://example.com:2057/test.xml in igoogle so i think the problem is with the manifest.
What can the problem be and how can i validate the manifest file and trouble-shoot this sort of problem.
Thanks
You can use the same gadget spec more than once. The reason it does not update is that the gadget spec (the XML file) is cached by Google.
To overcome this problem: Sign out from gmail, then sign in again. Then, in the address bar, add the parameter &nogadgetcache=1 and press enter to load the page. Then open an email message and look at your gadget.
On the same subject... if you make any changes to your Application Manifest, then the data access specs change. You should login to your Google Apps dashboard and click your app. You'll possibly see that you need to review and re-grant data access to your app because of the changes you made. And even if no warning is displayed, it does not hurt to revoke and then grant access again to make sure google updates the data access rules for your app in this domain.
finally i found out the problem - you cannot use the same gadget spec twice.
So i made a fresh copy of the gadget spec - http://example.com:2057/test_V2.xml,
and that got it working.
See http://code.google.com/apis/gmail/gadgets/contextual/ at the paragraph "Reusing a gadget spec"

Setup resources for GlassFish2.x Cargo deployment

I'm trying to get integration testing working for a GlassFish 2.x project, using Maven2 and Cargo. I finally have Cargo attempting to deploy my EAR but it fails to start because the data source is not configured. The app also depends on a few JMS queues and a connection factory - how do I add these?
The Cargo Glassfish 2.x plugin says existing configurations are not supported, so I can't do that.
Using the maven-glassfish-plugin is an option, but we also run OC4J so a Cargo solution would be preferred.
edit: The resources are: 1 JDBC connection pool, 1 JDBC resource, 4 JMS queues, 2 JMS connection factories and a custom security realm (pear tree optional). The realm needs an entry in the login.conf like:
myRealm {
uk.co.mycom.MyGlassFishLoginModule required;
};
I'm not sure (I never used this) but IIRC, you should be able to put your datasource configuration in a sun-resources.xml file and package it under META-INF/sun-resources.xml in your EAR and GlassFish is supposed to create the resources at deploy time.
Here is an example sun-resources.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems Inc.//DTD Application Server 9.0 Domain//EN" "sun-resources_1_3.dtd">
<resources>
<jdbc-connection-pool name="SPECjPool" steady-pool-size="100"
max-pool-size="150" max-wait-time-in-millis="60000"
pool-resize-quantity="2" idle-timeout-in-seconds="300"
is-isolation-level-guaranteed="true"
is-connection-validation-required="false"
connection-validation-method="auto-commit"
fail-all-connections="false"
datasource-classname="oracle.jdbc.pool.OracleDataSource">
<property name="URL"
value="jdbc:oracle:thin:#iasperfsol12:1521:specdb"/>
<property name="User" value="spec"/>
<property name="Password" value="spec"/>
<property name="MaxStatements" value="200"/>
<property name="ImplicitCachingEnabled" value="true"/>
</jdbc-connection-pool>
<jdbc-resource enabled="true" pool-name="SPECjPool"
jndi-name="jdbc/SPECjDB"/>
</resources>
Give it a try.
Resources
The sun-resources.xml File
Thanks, that worked. The datasource seems to have gone in okay and the app has deployed. However from the doc you linked, I can't see how to add the other things I need (edited more detail into my question about these). This solution also means that I will have to (use profiles to?) build my EAR differently for IT, which is imperfect.
I somehow missed that you wanted to create other resources than Datasources and I've seen several threads reporting that the suggested approach won't work with GlassFish v2 for any resources (like JMS resources). My bad.
So, given the current state, your options are (IMO):
contribute to Cargo to provide an "existing" configuration implementation for GlassFish v2
use the maven-glassfish-plugin as you suggested
I don't have any better suggestions.

WCF logging not working, trying to get ANY information on why services don't work

I have deployed a few WCF services to a server via a web setup project
they are being hosted in an IIS Application, which appears to be running fine.
However when i try to navigate to the wsdl, nothing is found.
I am trying to set up diagnostics logging, to get some information.
I have followed the advice from here: wcf trying to set up tracing to debug, not writing to log file
Also, I have tried what is in the referenced MSDN documentation: under "Recommended Settings for Deployment or Debugging" .. my web.config has that identical configuration. But no log file is being created.
Nothing useful in the event viewer.
Any ideas?
Could be a permissions issue; IIRC those don't always turn up in the event log. Ensure the user IIS runs under has write permissions to the log file path.
This is typically the diagnostic config I use. Seems to work for me.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
...
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel"
switchValue="Verbose">
<listeners>
<add name="sdt"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="D:\wcfLog.svcLog" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
If you are not getting any output it may be because your service is not starting correctly. The ServiceHost must be up for diagnostics to output anything. With IIS even though your site is running it does not mean that the ServiceHost started correctly. It's usually a config issue. I'm not a web guy but doesn't IIS write to EventViewer if there is an unhandled exception in the website?
Also, you could try creating a custom ServiceHostFactory. That way your code controls the ServiceHost creation and you can trap any exceptions and log them on your own.
Creating a custom ServiceHost in IIS -> LINK
This is an old question but for the benefit of anyone who might stumble upon the issue:
Make sure you have configured both the system.diagnostics and the System.serviceModel/diagnostics sections configured.
Make sure you have them configured in the correct App.config/Web.config file. The thing to note is that multiple config files may exist in a project, and the one used depends on the Build Configuration.
Personally I had the very same symptom until I noticed that I put the sections
under app.config (in my case, client side tracing), instead of
app.DebugLocal.config. The later was used as my build configuration was set to DebugLocal.