Checkin Notification with StarTeam - starteam

Does someone know how we can have Starteam send email notifications when a check in occurs? We are using Starteam 2006 R2.

Unfortunately StarTeam doesn't offer the ability to execute post-checkin actions. You may be able to use an application like Cruise Control to monitor your repository for changes and then take action upon seeing them.

I had a similar need a few months ago, this is what I discovered:
Starteam does not have commit hooks but it does have Starteam MPX (borland.com). From that link,
StarTeamMPX is a framework for publish/subscribe messaging. The StarTeamMPX Server uses an advanced caching and communication technology that both improves the performance of StarTeam clients and extends the scalability of the StarTeam Server.
Ok, so, we can subscribe to events. It's looking promising.
There is a Java API (borland.com) for Starteam, create an app using this API with your own emailing implemention of the CheckinListener interface. The app will then have to connect to Starteam, find any views that you're interested in and register listeners against them. And then wait.
Your listener will receive CheckinEvents and can interrogate these. Unfortunately, it appears to be on a file by file basis. I couldn't see anything in the API to say "commit finished", only "file finished". You are able to discover if a commit was cancelled. I don't know how easy it is to combine file checkin events back into a complete check in event.
*StarteamMPX is an extension (paid) to Starteam, it is available for 2006 R2. All of this is clearly only applicable if it is enabled.
My Experience:
My company didn't have that extension enabled, and to enable it required upgrading i.e. more money. So it didn't happen (I think it's painful enough paying for Starteam to begin with). At this point I abandoned my research and none of the above was ever implemented this. I hope this is some use to someone.

I've been doing some homework into this topic too, so will share what I've learnt.
MicroFocus now offer a Notification Agent tool for this sort of thing:
http://www.youtube.com/watch?v=QTKAT-ufkIs
It's an extra you pay for though.
I've been also pondering how to "roll-your-own" via advice given in Dan's post above. Yes, MPX does seem to be the way to go, although after studying the CheckinListener, this isn't the class you're after. To clarify, CheckinListener is used by the client performing the check-in, so that it can monitor progress of the check-in (perhaps to display a progress bar, that sort of thing).
Here's some sample-code of what listening to MPX events looks like:
Server s = new Server(strAddress, nPort);
s.connect();
s.enableMPX(); // must do this for MPX support
s.logOn(strUsername, strPassword);
Project p = s.findProject("mylovelyproject");
View v = p.s.findView("mylovelyview");
ItemListener listener = new ItemListener()
{
public void itemAdded(ItemEvent e)
{
System.out.println("itemAdd() - " + e.getNewItem().getComment());
}
public void itemMoved(ItemEvent e)
{
System.out.println("itemMoved() - from: " + e.getOldItem().getParentFolderHierarchy() + ", to: " + e.getNewItem().getParentFolderHierarchy());
}
public void itemChanged(ItemEvent e)
{
System.out.println("itemChanged() - " + e.getNewItem().getComment());
System.out.println(" - from: v" + e.getOldItem().getDotNotation().toString());
System.out.println(" - to: v" + e.getNewItem().getDotNotation().toString());
User locker = e.getNewItem().getLocker();
if (locker != null)
System.out.println(" - locked by:" + locker.getDisplayName());
else
System.out.println(" - not locked");
}
public void itemRemoved(ItemEvent e)
{
System.out.println("itemRemoved() - " + e.toString());
}
};
v.addItemListener(listener, s.getTypes().FILE);
The MPX-related items to focus on here are new ItemListener() (what to do about the events you listen to) and v.addItemListener() (which starteam view you want to listen to).
The sample code will spit out various print output to the console as files in your view are added/modified/moved/deleted.
Apart from ItemListener, you also have ViewListener and ProjectListener. Each interface provides a different scope of events to listen for, more info on this in the sdk docs, also a nice article here:
http://conferences.embarcadero.com/article/32231#MPXEventHandling
So if you want to roll-your-own notification emails, these MPX events provide part of your answer (a way to listen to these change-events).
Other aspects you'll need to look into after this are:
How to allow users to subscribe to various servers/projects/views, to decide what they want to listen to.
How to email to the user what they want (StarTeam's Server class offers a .SendMail() method, which can help here).
Once all these bases are covered, you should have something that does the trick. I'll be working on something like this myself over the coming days, I'll share what I can.

Related

How give trust to an external application accessing the Outlook Object Model (with all security options on)

I have a .NET application that interacts with Outlook like this:
Microsoft.Office.Interop.Outlook.Application app = new
Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem item = app.CreateItem((Microsoft.Office.Interop.Outlook.OlItemType.olMailItem));
item.PropertyAccessor.SetProperty(PsInternetHeaders + Foobar, 1031);
item.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
item.To = "a#test.com;b#test.com;c#test.com";
item.BCC = "cc#test.com";
item.Body = "Hello There!";
item.Display();
Be aware that I need to access the "PropertyAccessor" property.
In a normal environment this runs fine, but in a "secure" enviroment with this registry keys in place it just fails with Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)):
[HKEY_CURRENT_USER\Software\Policies\Microsoft\office\16.0\outlook\security]
"PromptOOMAddressBookAccess"=dword:00000000
"AdminSecurityMode"=dword:00000003
"PromptOOMAddressInformationAccess"=dword:00000000
Outlooks security model seems to have a "trustedaddins" list, but I'm not really sure if this applies to "external applications" as well and that exactly I need to register unter TrustedAddins (see here).
My main question would be: Can I just register and foobar.exe unter trustedaddins or is this not possible at all?
I know that I could lower or disable the security stuff, but this is not my choice ;)
Your only options are listed at How to avoid Outlook Security Alert when sending Outlook message from VBScript?
You also might want to set PsInternetHeaders properties to strings only, not ints.

Xamarin Forms - How to open specific page after clicking on notification when the app is closed?

I'm actually working on a Xamarin Forms application that need push notifications. I use the Plugin.PushNotification plugin.
When the app is running in the foreground or is sleeping (OnSleep), I have no problem to open a specific page when I click on a notification that I receive. But I was wondering how can I do that when the app is closed. Thanks!
I finally found the answer by myself and I want to share it in case someone needs it.
Nota bene: according to the official documentation of the plugin, it's Xam.Plugin.PushNotification that is deprecated. I use the new version of this plugin, Plugin.PushNotification which uses FCM for Android and APS for iOS.
There is no significant differences to open a notif when the app is running, is sleeping or is closed. Just add the next callback method in the OnCreate method (MyProject.Droid > MainApplication > OnCreate) and FinishedLaunching method (MyProject.iOS > AppDelegate > FinishedLaunching):
CrossPushNotification.Current.OnNotificationOpened += (s, p) =>
{
// manage your notification here with p.Data
App.NotifManager.ManageNotif(p.Data);
};
Common part
App.xaml.cs
// Static fields
// *************************************
public static NotifManager NotifManager;
// Constructor
// *************************************
public App()
{
...
NotifManager = new NotifManager();
...
}
NotifManager.cs
public class NotifManager
{
// Methods
// *************************************
public void ManageNotif(IDictionary<string, object> data)
{
// 1) switch between the different data[key] you have in your project and parse the data you need
// 2) pass data to the view with a MessagingCenter or an event
}
}
Unfortunately there is no succinct answer for either platform. Generally speaking, you need to tell the OS what to do when it starts the app as a result of the push notification. On both platforms, you should also consider what API level you are targeting, otherwise it won't work or even crash the app.
On iOS, you will need to implement this method in AppDelegate appropriately: FinishedLaunching(UIApplication application, NSDictionary launchOptions). The launchOptions will have the payload from the push notification for you to determine what to do with it (e.g. what page to open). For more information on iOS, Xamarin's documentation is a good place to start.
Android has a more complicated topology in terms of more drastic differences between API levels, whether you are using GCM/FCM, as well as requiring more code components. However, to answer the question directly, you will need to handle this in OnCreate(Bundle savedInstanceState) of your main Activity. If you are using Firebase, the push notification payload is available in Intent.Extras. Again, Xamarin's documentation has a good walkthrough.
Finally, note that the Plugin.PushNotification library you are using has been deprecated. I suggest you either change your library and/or your implementation soon. Part of the reason that library has been deprecated is because Google has deprecated the underlying Google Cloud Messaging (GCM) service, which will be decommissioned on April 11, 2019.

Best Way to Send Scheduled E-Mail in .NET MVC3 Application using MVCMailer

I am working on a .NET MVC3 C# Application. This application is hosted on our own Server.
Now I want to Send Scheduled Email in my application like daily(at a specific time),Weekly, monthly and so on...
Currently I am using MVCMailer to send Emails in my application.
I tried Fluent Scheduler to send scheduled Emails, but it doesn't works with MVCMailer. It Works fine if I send mails without MVCMailer and for other scheduling jobs.
It gives me a ERROR NULLReferenceException and says HTTPContext cannot be null.
What can I do to solve this problem.
Also suggest me which will be the best way to send E-mails in my applicaton.
Windows Service (Having own server)
Scheduler (Fluent Scheduler)
SQL Scheduled jobs
I am attaching ERROR snapshot:
It could be that MVCMailer depends on an HttpContext, which will not exist on your scheduled threadlocal's.
You could consider scrapping MvcMailer and implementing your own templating solution. Something like RazorEngine (https://github.com/Antaris/RazorEngine), which gives you the full power of Razor without having to run ontop on an Http stack. You could still source your templates from disk so that your designers could modify it.
Then you could mail the results using the standard classes available from .net.
For e.g.:
string template = File.ReadAllText(fileLocation);//"Hello #Model.Name, welcome to RazorEngine!";
string emailBody = Razor.Parse(template, new { Name = "World" });
SmtpClient client = new SmtpClient();
client.Host = "mail.yourserver.com";
MailMessage mm = new MailMessage();
mm.Sender = new MailAddress("foo#bar.com", "Foo Bar");
mm.From = new MailAddress("foo#bar.com", "Foo Bar");
mm.To.Add = new MailAddress("foo#bar.com", "Foo Bar");
mm.Subject = "Test";
mm.Body = emailBody;
mm.IsBodyHtml = true;
client.Send(mm);
Obviously you could clean this all up. But it wouldn't take to much effort to use the above code and create some reusable classes. :)
Since you already have the FluentScheduler code set up, you may as well stick with that I guess. A windows service does also sound appealing, however I think that it's your call to make. If it's a simple mail service you are after I can't think of any reason not to do it via FluentScheduler.
I have created a full example of this available here: https://bitbucket.org/acleancoder/razorengine-email-example/src/dfee804d526ef3cd17fb448970fbbe33f4e4bb79?at=default
You can download the website to run locally here: https://bitbucket.org/acleancoder/razorengine-email-example/downloads
Just make sure to change the Default.aspx.cs file to have your correct mail server details.
Hope this helps.
Since MVC Mailer works best in the HTTP stack (i.e. from controllers), I've found that a very reliable way to accomplish this is by using Windows Task Schedule from a server somewhere. You could even spin up a micro instance on Amazon Web Server.
Use "curl" to call the URL of your controller that does the work and sends the emails.
Just setup a Scheduled Task (or Cron if you want to use *IX) to call "c:\path_to_curl\curl.exe http://yourserver.com/your_controller/your_action".
You could even spin up a *IX server on AWS to make it even cheaper.

How do I know when an Amazon EC2 operation is complete?

Besides polling, how can I tell when a long-running Amazon EC2 operation is complete? For example, using the CreateImage API function can take upwards of several minutes.
Right now I'm doing this:
// MAKE THE API CALL
var createRequest = new CreateImageRequest().WithInstanceId("i-123456").WithName("MyNewAMI");
var createResponse = myAmazonEC2Client.CreateImage(createRequest);
var imageId = createResponse.CreateImageResult.ImageId;
// ICKY POLLING CODE
bool isImaging = true;
while (isImaging)
{
var describeRequest = new DescribeImagesRequest().WithImageId(imageId);
var describeResponse = myAmazonEC2Client.DescribeImages(describeRequest);
isImaging = describeResponse.DescribeImagesResult.Image.Single().ImageState == "pending";
Thread.Sleep(10000); // sleep for 10 seconds
}
// CreateImage IS COMPLETE; MOVE ON WITH OUR WORK
I hate this. After calling CreateImage, I'd like to just get notified somehow that it's all done and move on. Is this possible? I'm using the AWS .NET SDK in this example, but I'm not looking specifically for a C# solution.
UPDATE: Cross-posted to the AWS Forums
Some events in amazon can be configured to send notifications to an SNS Topic. For example when using auto scaling you can have notifications when a server is launched and terminated. As far as I know there is no way to trigger these notifications for other services such as CreateImage. I've looked for this type of feature in the past with no luck. I was trying to do it to create a script that would launch servers in a specific order. I wound up just polling their API as I couldn't find any way to register to those events.
James Hunter Ross answered this question over on the AWS Forums as follows:
Polling is it. That said, since you have a C# program started, why not let it spawn a polling process that notifies you as you wish? It seems you are almost done, in some respects.
(Of course, it would be nice if such functionality was built-in at AWS.)
I wasn't able to find a StackOverflow profile for him, but if he shows up I'll edit this to give him credit.

Ready event in Microsoft Outlook 2010?

Is there an event in Microsoft Outlook 2010 which one can subscribe on, in order to known when Outlook has finished initializing and all components, folders etc. have been loaded?
Not sure about VSTO but good ol' COM addins get the StartupComplete "event" (via IDTExtensibility2) for exactly that purpose.
Ok, I found out what I needed to do...
...
private void ThisAddInStartup(object sender, EventArgs e)
{
this.Application.Startup += ApplicationStartup;
this.Application.ItemLoad += ApplicationItemLoad;
}
void ApplicationItemLoad(object Item)
{
//Do something
}
private void ApplicationStartup()
{
//Do something
}
...
http://msdn.microsoft.com/en-us/library/ff869298.aspx
Not that I'm aware of. Usually, addins don't do anything that requires talking with many outlook objects till some triggering event happens (like opening a mail, or creating a new inspector) so THAT'S when you'd typically see some custom code hooked in.
In my addins, the code connected to startup does things like load up some config, and maybe connect to a DB (although even that I tend to do on demand vs once at startup).

Resources