Generator job failing on object property default - qooxdoo

I have an OpenLayers object that I'm trying to change that has the name default as one of it's properties. The Qooxdoo generator script does not like this. Is there a way to ignore this error?
I tried:
/**
* #ignore default
*/
Here is the object in question:
vectorLayer.styleMap.styles.default.defaultStyle.fillColor="#FFFFFF"

default is one of JavaScript's reserved words. Those aren't supposed to be used as identifiers, and the Generator enforces this restriction. You can work around it by using the bracket notation:
vectorLayer.styleMap.styles["default"].defaultStyle.fillColor="#FFFFFF"

Related

Parse HTML markup and return Node[]

I am trying to use Project Fluent to translate a webpage using React and SSR (in particular, Remix). The library allows for using markup in the translation texts, e.g.
hello = Hello, and <italic>welcome</italic>
However, the built-in parser uses the document object which is not availble on the server. In their docs, Project Fluent specifies that in this case it is possible to provider your own parser. This must be a function with the following signature:
(str: string) => Node[]
where Node is the default DOM Node interface.
As suggested by Fluent themselves, I have attempted to use cheerio to solve this, but I am unable to produce a function with the correct signature. This is the closest I have gotten this far:
import * as cheerio from 'cheerio';
function parseMarkup(str: string) {
return cheerio.load(str)._root.childNodes;
}
In particular, this solution is missing nodeName and textContent which are the only two properties strictly required by Fluent. I think the best solution would hovewer to implement a function which returns an array of proper Node-objects to avoid having to use // #ts-ignore.
Any help implementing a parser with the correct signature is greatly appreciated.

ODI 12C Smart import with actions using SDK

HI I'm able to smart import Projects in ODI using SDK. but i'm unable to use the predefined method which sets actions like merge, create copy, ignore, reuse, while importing the projects.
Please help me to implement the below method,
setMatchedFCODefaultImportAction(java.lang.String pFCOObjType, int pSmartImportAction)
by using below method i'm directly importing projects.
importObjectsFromXml (fnameAndPath, ExportKey, ExportWithoutCipherData);
I want to implement above mentioned actions, please help me.
thanks
Unfortunately you can not use setMatchedFCODefaultImportAction to specify the action for a specific object like a project as in your code :
smartImpServ.setMatchedFCODefaultImportAction("Dev_ODI_Project", 1);
It can only define the default action for a First Class Object i.e. for all the objects of a specific type. For instance you can set the default actions for any project as CREATE/COPY (equivalent to 1 as you used in your code):
smartImpServ.setMatchedFCODefaultImportAction(ISmartImportService.PROJECT_OBJECT_NAME, ISmartImportService.SMART_IMPORT_ACTION_CREATE_COPY);
The values you can use as the pFCOObjType parameters are all the Fields ending by _OBJECT_NAME in the ISmartImportService interface.
If you want to specify the action for a specific object, you would need to use a response file from a previous import with the importFromXml method.

EXT4JS Name Conventions

I'm using EXTJS 4.1 and I'm naming my components as follows. If I create a store I end it with Store and I do the same for Controllers, Models, etc. So I may have UserStore.js. I then put it in a controller. Now EXTJS will create getter and setters for it but the way it does it, is they append the name "Store" to the end so I now have the following: getUserStoreStore(). Which I don't like.
But I want to append Store to my file names so I know what files I'm working in. So for example I may have a UserModel.js, UserStore.js, UserView.js, UserController.js. If I didn't I would have 4 files Called User.js and it would be a pain to always have to remember which file I'm working in.
So my question is there a config to change the way EXTJS names these getters and setters, or do I have to live with getUserStoreStore. It gets even uglier is I have sub dir under stores so for example if I have the following:
-store
-user
-UserStore.js
-UserPersmission.js
I define the store like this:
Ext.define('MyApp.store.user.UserStore'
I then get the following setter:
getUserUserStoreStore()
Yuck! Any idea or do I just live with this?
The short answer is No
You can only change it by overriding the method that creates the 'getter', cause there is no config. Other than, f.e. .Net ExtJS uses namespaces to identify the type (f.e. the controller namespace) and not a applied suffix. In addition; other suffixes are applied by the array into which the class has been placed (f.e. store, model, view).
I recommend you to just divide by namespaces.

CakePHP 2.0 magic find functions with unconventional table column names

So, I would like to use this magic find function in my CakePHP 2.0 app:
$profile = $this->Profile->findByUserId($user['User']['id']);
However, the field in question is called userId, not user_id. The code above throws an error - column user_id is missing.
Is there a way to force Cake to try to look for camel cased column names?
Thanks for reading!
You will have to override the appropriate function for that. Cake's conventions are just that, conventions. If you stray from them, you'll need to put in more manual work. So either create the function findByUserId in the appropriate model, or override the magic __call function.

Can i get the filename like #[header:originalFilename] in a component in mule3

I use
<gzip-compress-transformer/>
<base64-encoder-transformer/>
after a file connector, and then write a component to deal with the gzip+base64 content.
How can i get the file name in the component?
Note that we introduced annotations in Mule 3 for doing runtime injection, this means you can specify how to invoke a component without needing transformers i.e.
public void save(#Payload String fileContents, #InboundHeaders("originalFilename") String originalFilename)
See: http://www.mulesoft.org/documentation/display/MULE3USER/Creating+Service+Objects+and+Transformers+Using+Annotations
Does your component implement Callable? If not, do you want to keep your component Mule-unaware?
Based on your answers to these questions, different options exist:
With Callable, you get the headers in message.getProperty...
Without implementing Callable, you can access RequestContext to get the current Mule event and from there reach the message properties. But this makes your component Mule aware.
Otherwise, have your component's method take a second parameter (String originalFilename) and use a standard expression transformer to transform the payload in an array that contains: #payload, #[header:originalFilename]. This arrays will then be passed as arguments to your component's method.
[message.outboundproperties[originalFilename]]
with this expression you can get the original file name in the component.

Resources