How to create live template like `condition.if` that natively supported by JetBrains IDE? - jetbrains-ide

In JetBrains IDE including PHPStorm, PyCharm, IntelliJ Idea, I can type this
age > 0.if
Then press tab and I will get
if (age > 0) {
}
In my application I need to type a lot of these:
const resPartnerFactory = new BaseModelFactory(ResPartner);
const accountChartTemplateFactory = new BaseModelFactory(AccountChartTemplate);
const resCompanyFactory = new BaseModelFactory(ResCompany);
And want to create a live template like
ResPartner.bmf
I have created these
How to finishe the .bmf part?

Related

How to create an image import job using KTA SDK?

I am trying to create a job using SDK. Simple job with send email activity work like a charm!
But when I try to create a job with variables input folder to import few images it doesn't work at all. Am I missing very trivial settings ?
My process has classification activity & extraction activities
Variables : DefaultImportFolder
FYI : My process works fine if I set import settings -> import sources. That tells me there is no issue with my process process Smile. But when I try to run through console app with dynamic variables, it doesn't work.
Following is my sample code. Any help?
ProcessIdentity processIdentity = new ProcessIdentity
{
Name = "SDK TestProcess"
};
var jobService = new TotalAgility.Sdk.JobService();
JobInitialization jobInitialization = new JobInitialization();
InputVariableCollection variablesCollections = new InputVariableCollection();
InputVariable inputVariable = new InputVariable
{
Id = "DefaultImportFolder",
Value = #"\\FolderPath",
};
variablesCollections.Add(inputVariable);
inputVariable = new InputVariable
{
Id = "ExportSuccess",
Value = "true"
};
variablesCollections.Add(inputVariable);
var createJobAndProgress = jobService.CreateJob(sessionId, processIdentity, jobInitialization);
Console.WriteLine($"Job ID {createJobAndProgress.Id}");
As Suggested by Steve, tried with WithDocuments method Still no luck .....
JobWithDocumentsInitialization jobWithDocsInitialization = new JobWithDocumentsInitialization();
Agility.Sdk.Model.Capture.RuntimeDocumentCollection documentsCollection = new Agility.Sdk.Model.Capture.RuntimeDocumentCollection();
Agility.Sdk.Model.Capture.RuntimeDocument runtimeDoc = new Agility.Sdk.Model.Capture.RuntimeDocument
{
FilePath = #"FolderPath\abc.tif",
};
documentsCollection.Add(runtimeDoc);
jobWithDocsInitialization.Documents = documentsCollection;
var jobIdentity = jobService.CreateJobWithDocuments(sessionId, processIdentity, jobWithDocsInitialization);
Console.WriteLine($"Job ID {jobIdentity.Id}");
A folder variable represents a reference to a folder that already exists in the KTA database, so you can't just set a file path to the variable. When you create a job via an import source, it is creating the folder and documents as part of creating the job.
To do the same in your code, you would use one of the "WithDocuments" APIs such as CreateJobWithDocuments which has parammeters specific to importing documents into the process, including by file path.
As discussed in this other answer (Kofax TotalAgility Send a PDF Document to Jobs Queue (KTA)), you may want to look at the sample code that is included with the product (that most people don't realize is available), and also look at other API functions for more context on the parameters needed for the "WithDocuments" APIs mentioned above.

not a valid calendar for the given culture.parameter name: value

here is my scenario. i build xamarin forms app. when the user device language is English it works fine..but in Arabic language . any page he open that contains DatePicker or datetime the app crashes ..any help please.
This is a known Xamarin bug, which they unable to fix since I reported it in 2015.
In brief linker thinks that you don't need Other calendars rather than default.
Even though the project settings specify that it supports these languages.
In order to workaround it create calendars in your code. (Force linker to include them)
And call it from AppDelegate.cs or from other Famarin Forms app init method:
private static void PreventLinkerFromStrippingCommonLocalizationReferences()
{
_ = new System.Globalization.GregorianCalendar();
_ = new System.Globalization.PersianCalendar();
_ = new System.Globalization.UmAlQuraCalendar();
_ = new System.Globalization.ThaiBuddhistCalendar();
}
https://github.com/xamarin/xamarin-android/issues/2511
Try specifying a locale when using the date value from the image picker
var dateFormatter = new NSDateFormatter
{
DateFormat = _dateFormatString
};
var enLocale = new NSLocale("en_US");
dateFormatter.Locale = enLocale;
sender.Text = dateFormatter.ToString(modalPicker.DatePicker.Date);

How to get Project Guid and Model Guid from PathName?

My Revit model has an RVT link with a PathName = "BIM 360://Testing Link Edit in BIM360/ArchitectureBIM360.rvt"
I want to construct a ModelPath and use it to open the cloud-hosted file as follows:
ModelPath mp = ModelPathUtils.ConvertCloudGUIDsToCloudPath(projectId, modelId);
linkDoc = uiapp.OpenAndActivateDocument(mp, new OpenOptions(), false, new cloudCallback()).Document;
How do I get the projectId and modelId GUIDs from the PathName?
Using Forge Data Management API you can list Hubs > Projects > Folders > Items > Versions. An item is essentially a file, but it can have 1+ versions, so that's why you need the specific version. This tutorial guides you on the steps.
Once you list version of an item, it should be an array under .data, each entry on the array should have something like (simplified):
{
"type":"versions",
"id":"urn:adsk.wipprod:fs.file:vf.abcd1234?version=1",
"attributes":{
"name":"fileName.rvt",
"displayName":"fileName.rvt",
...
"mimeType":"application/vnd.autodesk.r360",
"storageSize":123456,
"fileType":"rvt",
"extension":{
"type":"versions:autodesk.bim360:C4RModel",
....
"data":{
...
"projectGuid":"48da72af-3aa6-4b76-866b-c11bb3d53883",
....
"modelGuid":"e666fa30-9808-42f4-a05b-8cb8da576fe9",
....
}
}
},
....
}
Update
From the comment, on Revit desktop, you can use:
ModelPath path = doc.GetCloudModelPath();
Guid guid1 = path.GetModelGUID();
Guid guid2 = path.GetProjectGUID();
I'm not using the Forge API yet (I really need to go through the tutorial myself). I do not know if this would help in anyway or if you found the answer you were looking for but the cache folder does contain all the file and project GUIDs including links: "C:\Users\username\AppData\Local\Autodesk\Revit\Autodesk Revit 2019\CollaborationCache\2008062704538XX\4680d561-ed69-4a61-b9b2-587582b1627a\LinkedModels\1f96b01e-640e-4e16-93af-edcc11769570.rvt"
In the below path:
C:\Users\username\AppData\Local\Autodesk\Revit\Autodesk Revit 2019\CollaborationCache\2008062704538XX\4680d561-ed69-4a61-b9b2-587582b1627a\LinkedModels\1f96b01e-640e-4e16-93af-edcc11769570.rvt"
2008062704538XX is the oxygen ID which is a unique ID and it is linked to your Autodesk account.
4680d561-ed69-4a61-b9b2-587582b1627a is the GUID of the Project.
1f96b01e-640e-4e16-93af-edcc11769570 is the GUID of the linked model.

Admob issues on Xamarin iOS apps with Admob SDK version 6.12.0

I am currently using the Google AdMob Xamarin component (version 6.12.0 - see https://components.xamarin.com/view/googleadmob) to display DFP interstitials and banner ads (displayed at different points within a tableview) on an iOS app. When I am debugging in Visual Studio 2013 I get the following output:
<Google:HTML> You are currently using version 6.12.0 of the SDK, which doesn't
officially support iOS 8. Please consider updating your SDK to the most recent
sdk version, 6.12.2, to get iOS 8 support, including a fix for smart banner
rendering in landscape mode. The latest SDK can be downloaded from
http://goo.gl/iGzfsP. A full list of release notes is available at
https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes.
According to the Xamarin component's page, 6.12.0 does actually support iOS 8. Should I ignore the warning that I am getting? If not, how do I go about using 6.12.2 when the newest version of the component is only 6.12.0? Is it OK to stay with 6.12.0 or will it cause issues?
I have noticed that the banner ads aren't really displaying in the correct location on iOS8, they are slightly to the right and down from where they should be. Is this because of the SDK or some other change in iOS8 regarding how cells are displayed?
Below is how I display the banner ad:
public void InitialiseBanner(AdMobView property)
{
_bannerViewDelegate = new AdMobBannerViewDelegate();
_bannerView = new DFPBannerView();
float x = (CurrentWidth/2) - (AdvertWidth/2);
_bannerView.RootViewController = this;
_bannerView.BackgroundColor = UIColor.White;
_bannerView.Delegate = _bannerViewDelegate;
_bannerView.Frame = new RectangleF(x, 5, AdvertWidth, 50);
View.Frame = new RectangleF(0, 0, CurrentWidth, 50);
View.AddSubview(_bannerView);
_bannerView.AdUnitID = "/**UNITIDREMOVED**/" + property.AdAlias;
GADRequest request = GADRequest.Request;
.
.
.
_bannerView.LoadRequest(request);
View.BringSubviewToFront(_bannerView);
if (DeviceHelper.IsIos8OrGreater && RespondsToSelector(new Selector("separatorInset")))
{
_bannerView.LayoutMargins = UIEdgeInsets.Zero;
}
}
As for a normal banner, try loading your AdView Like this:
(This is my working example)
As a class level declaration, type this:
GADBannerView adView;
bool viewOnScreen = false;
// Get you own AdmobId from: http://www.google.com/ads/admob/
const string AdmobId = "<your admob id>";
Then in your viewDidLoad you can specify position of your banner and load it:
adView = new GADBannerView (size: GADAdSizeCons.Banner, origin: new PointF (0, UIScreen.MainScreen.Bounds.Height-100)) {
AdUnitID = AdmobId,
RootViewController = this
};
adView.DidReceiveAd += (sender, args) => {
if (!viewOnScreen) View.AddSubview (adView);
viewOnScreen = true;
};
adView.LoadRequest (GADRequest.Request);
I get the same error as well, but it doesn't actually matter. I also thought first that this was the issue but my setup was a bit wrong, i think that is the same for your code. In my example i just added my AdView to the MainView, but using custom cells you should be able to implement it in your UITable View. Also, have a look at the example provided in the components section. As for displaying DFP interstitials: There has to be something wrong with the setup as well, but i can't see it in the code you provided.

How to instanciate same dialog in MFC C++?

I want to build a MFC dialog in which I add a simple TabControl. I want my tab pages to be instances of the same CDialog, but with some different parameters (such as which buttons are shown, for example).
I am using Visual Studio 2008.
I am relatively new to C++, but I've seen that each component (CButton, CDialog) has its own ID (which is static, so I theoretically I can't instance the same component twice).
I would like to know how to do something like this:
for (index = 0 to tabNumber) {
name = "TAB"+index;
tabCtrl.add(new CustomDialog(name, i));
}
You have to give different TabID while creating item.
OnInitDialog()
{
m_cTab.Init();
m_cTab.InsertItem(0,"Register new user");//tabID=0
m_cTab.InsertItem(1,"Identify");// TabID=1
//Register new user
m_cTab.CreateButton("Load Image",23,TabID=0, 0, m_cTab.RightOf(22)+15, m_cTab.TopOf(19),60);
//Identify
m_cTab.CreateButton("Register User",24,TabID=1,P_LEFT,0, m_cTab.TopOf(20) ,60);
}

Resources