how to create project hierarchical view in pyqt inside main window - parsing

I'm trying to implement a project structure viewer to view the structure of a specific programming language. and this project structure view should look like a the tree widget in PyQT , like project explorer in Eclipse.
Example:
if my code is :
rule Adzok
{
meta:
author = " Kevin Breen <kevin#techanarchy.net>"
Description = "Adzok Rat"
Versions = "Free 1.0.0.3,"
strings:
$a1 = "config.xmlPK"
$a2 = "key.classPK"
$a3 = "svd$1.classPK"
condition:
7 of ($a*)
}
Check the figure below.

Related

How to pass parameter to the table's datasource with Telerik Reporting?

I have a table on my Telerik report where I want to pass parameters with the table's data source. I also have a report datasource with parameter but this does not help with the table's datasource and its parameter. Any help would be appreciated.
this.table1.DataSource = "GetLocationsData";
You have to set the available values source and most probably filters:
Telerik.Reporting.ReportParameter reportParameter1 = new Telerik.Reporting.ReportParameter();
this.csvDataSource1 = new Telerik.Reporting.CsvDataSource();
this.table1 = new Telerik.Reporting.Table();
this.csvDataSource1.Source = "id,text\r\n1,a\r\n2,b\r\n3,c";
this.table1.DataSource = this.csvDataSource1;
this.table1.Filters.Add(new Telerik.Reporting.Filter("= Fields.text", Telerik.Reporting.FilterOperator.Equal, "= Parameters.paramString.Value"));
reportParameter1.AvailableValues.DataSource = this.csvDataSource1;
reportParameter1.AvailableValues.ValueMember = "=Fields.Text";
reportParameter1.Name = "paramString";
reportParameter1.Text = "String";
reportParameter1.Value = "a";
reportParameter1.Visible = true;
this.ReportParameters.Add(reportParameter1);
If this does not help you, you can have a look at the available reports that come with the installation - replace in the path below your Telerik Reporting version, mine is R3 2022. View Code (F7) on the report's designer.cs file:
C:\Program Files (x86)\Progress\Telerik Reporting R3 2022\Examples\CSharp\.NET Framework\ReportLibrary
Another option if you are stuck, is to create the report in the Visual Studio Designer and View the generated code (F7) on the yourreportname.designer.cs file.
If the report was created using the web report or standalone report designer you can import the report definition file (trdp, trdx, trbp) into Visual Studio (will be converted to type definition .cs file) first.
Reference:
https://docs.telerik.com/reporting/designing-reports/connecting-to-data/report-parameters/how-to-add-report-parameters
https://docs.telerik.com/reporting/designing-reports/connecting-to-data/report-parameters/overview

How to Create a view that shows all existing attributes DOORS in all formal modules under a single project?

I have a project under which there are 50+ formal modules in IBM DOORS,
I want to create a single view for all modules ( As default view )
This view should display all the attributes that are available for that particular module when I open it.
And the number of attributes in some modules vary.
If anyone in stack-overflow knows a way on this, It would be really helpful!
Before anything, you should probably be aware that there is a maximum number of attributes that can be loaded into a view. You can check out this thread for more information regarding max columns:
https://www.ibm.com/developerworks/community/forums/html/topic?id=1861480b-7aa0-43b2-bf77-be677f5f778e
Now as for how to do this. If you're looking for an automated solution using DXL here's some sample code that you can modify for your purposes. The current code will add object-level attributes that aren't system attributes to the current view of the module you run this code from.
AttrDef ad
Module m = current Module
string sAttrName
int count = 0
Column col
for col in m do {count++}
for ad in m do
{
if ((ad.object) && (!ad.system))
{
sAttrName = ad.name
col = insert (column count)
attribute(col, sAttrName)
width(col, 200)
count++
}
}
Note: This code will only generate a view with all attributes in the module it is run from, it will not loop through all modules in a project or save the view.
To loop through a project and get all modules you'll need to create a recursive function using for itemRef in folder do {...}. Something like the following:
Folder f = current Folder
void recurseFolder(Folder f)
{
Item iRef
for iRef in f do
{
if (type(iRef) == "Formal")
(call your create views function here with parameter iRef)
else if (type(iRef) == "Folder" || type(iRef) == "Project")
recurseFolder(folder(iRef))
}
}
recurseFolder(f)
And then if you need additional code to save the view, you'll have to add appropriate code for that too using save(View v). You can look up additional information pertaining to setting view preferences and saving them in the DXL Reference Manual.

How to include third party code in an Xcode 6 + Swift Project

I want to include some third party code (specifically https://github.com/ortuman/SwiftForms) in my XCode 6 + Swift project. How do I do that?
Very easy :
Download the archive.
Extract it.
Move required files to your project folder
Add the required files to your project.
Clean project
It's done
Simply add the source .swift files to your project, (drag and drop to the file tree on the left hand side of Xcode - you can see the file tree here).
The files you'll need are here.
As stated on the github page: Swift projects is currently not supported by Cocoapods. Until support is available you should just clone the repository and drag the source folder into your project to use SwiftForms.
Once you have the source .swift files presenet in your Xcode project you can create a form as described in the documentation:
"Creating a form using SwiftForms is pretty straightforward. All you need is to derive your controller from FormViewController and define a FormDescriptor instance along with its sections and rows. Here is an example of how to create a simple form to input an email and a user password."
// Create form instace
let form = FormDescriptor()
form.title = "Example form"
// Define first section
let section1 = FormSectionDescriptor()
var row: FormRowDescriptor! = FormRowDescriptor(tag: "name", rowType: .Email, title: "Email")
section1.addRow(row)
row = FormRowDescriptor(tag: "pass", rowType: .Password, title: "Password")
section1.addRow(row)
// Define second section
let section2 = FormSectionDescriptor()
row = FormRowDescriptor(tag: "button", rowType: .Button, title: "Submit")
section2.addRow(row)
form.sections = [section1, section2]
self.form = form

Stanford type dependency, can not extract "prepositional modfier"

I am trying to extract the prepositional modifier, like it is stated in the Dependency Manual:
I try to parse the sentence :
"I saw a cat with a telescope" , using the code:
List<CoreMap> sentences = stanfordDocument.get(SentencesAnnotation.class);
for (CoreMap sentence : sentences) {
Tree tree = sentence.get(TreeAnnotation.class);
TreebankLanguagePack languagePack = new PennTreebankLanguagePack();
GrammaticalStructureFactory grammaticalStructureFactory = languagePack.grammaticalStructureFactory();
GrammaticalStructure structure = grammaticalStructureFactory.newGrammaticalStructure(tree);
Collection<TypedDependency> typedDependencies = structure.typedDependenciesCollapsed();
for (TypedDependency td : typedDependencies) {
System.out.println(td.reln());
}
}
As stated in the Manual I was expecting to get : prep(saw, with).
In the Collection of the TypedDependeny I get only
"nsubj; root; det; dobj; det; prep_with" as relation type, and not the "prep/prepc" as stated in the http://robotics.usc.edu/~gkoch/DependencyManual.pdf (page 8).
I have also tried to extract pcomp : Prepositional compelement (page 7 of the manual) and it doesnt find it.
Did somebody encountered the same problem? Am I doing anything wrong?
CoreNLP outputs "Collapsed dependencies preserving a tree structure" (section 4.4 of the manual) from my experience. I think it's the same thing here (e.g. prep_with is a collapsed dependency of prep(saw, with))

CultureInfo: Haitian Creole and .NET 3.5 on ASP.NET/MVC?

It's been easy to get French and Spanish translations added to our site, but we want to add Haitian Creole now and there is no Culture support for it. What's the best way to get this done?
You can create the culture through .Net using the CultureAndRegionInfoBuilder class. As this code needs to run with administrative privileges, it's generally advised that you do it as a separate program or script that runs as part of the installation stage of the software. Once it's set up, you can use it like any other Culture.
This example is based on the example in the MS .Net Application Development Foundation book (2nd ed. p697):
var builder = new CultureAndRegionInfoBuilder("en-PL", CultureAndRegionModifiers.None);
builder.LoadDataFromCultureInfo(new CultureInfo("en-US"));
builder.LoadDataFromRegionInfo(new RegionInfo("US"));
builder.CultureEnglishName = "Pig Latin";
builder.CultureNativeName = "Igpay Atinlay";
builder.IsMetric = true;
builder.ISOCurrencySymbol = "PLD";
builder.RegionEnglishName = "Pig Latin Region";
builder.RegionNativeName = "Igpay Atinlay Egionray";
builder.Register();
Once that's done, you can retrieve your culture in the program.
var culture = new CultureInfo("en-PL");

Resources