So I'm a bit new to bundle size performance improvements and something I'm trying to do is to reduce the import cost of my component library that's written in TSDX. It's a tool to create Typescript libraries based on rollup.js. I'm using the out of the box setup.
When I investigated my app I found out that the import cost of components from my component library seems to be a lot. See images:
It seems that when I import a single component (or function) there is a lot of other things imported as well. Is there someone out there that knows if this is normal and/or if I can improve this? Maybe someone knows how I can import it like how they do it with the lodash packages where you import a single util from a specific folder like so: import { add } from 'lodash/add'?
So long story short: how can I reduce the import cost of my TSDX (based on rollup.js) library? Thanks in advance!
I'm using TinyAuth CakePHP plugin to manage permissions on my website.
They also have a plugin to manage the ACL (access control list) using a Database with CakePHP 3.7+, but the plugin isn't working with CakePHP 4.0
I'm currently writing custom adapters to manage the authorizations with the Database, like suggested here.
My main problem is : I don't know where should I write my new adapters ?
Currently, they're in the TinyAuth vendor folder and I import them in app_local.php like this :
'TinyAuth' => [
'multiRole' => true,
'aclAdapter' => TinyAuth\Auth\AclAdapter\DbAclAdapter::class,
],
And this is working.
I didn't manage to make them work in my project folder, cause I cannot import the class (???)
Is it a safe / good way to do it ? Is it better for me to create my own plugin, or to write my php class elsewhere and import it ? Is it safe to import files in CakePHP 4 app_local.php ?
I'm really new to PSR-4 and CakePHP framework standards, so sorry if my question is dumb, but I really want to make things correctly...
Thank you by advance
You should never put stuff in the vendor folder, unless you're debugging, or you're facing some very, very weird edge case that absolutely cannot be solved in any other way, which however should be extremely rare. You'll loose your changes when the dependency is being updated.
If you want to learn about PSR-4, there's endless resources for that, start for example at the official website: https://www.php-fig.org/psr/psr-4/
All that being said, a quick example for a default CakePHP 4.x application based on the official application template:
Filepath: src/TinyAuth/Auth/AclAdapter/DbAclAdapter.php
Namespace: App\TinyAuth\Auth\AclAdapter
Classname: DbAclAdapter
Usage: 'aclAdapter' => \App\TinyAuth\Auth\AclAdapter\DbAclAdapter::class,
Whether you use the fully qualified name when referencing your class (leading backslash required), or using use statements to import the name, really doesn't matter from a technical point of view, it will work either way in any PHP file.
Whether you put your custom code directly in your app, or in a plugin or a regular library, really depends on how you plan to use it. If you want to reuse it, or make it public, then you'd probably want to to put it in a plugin/library.
I am building my own notification tray natively in Android. I am trying to use the less-obsolete android.app.Notification resources (instead of the now-deprecated NotificationCompat ones)
In one case I want to build a MessagingStyle with a bitmap icon. To do this, the class android.app.Person is required. (MessagingStyle doesn't support bitmat icons in NotificationCompat)
Looking at the docs I can see that android.app.Person was added in API level 28. CN1's build server throws the error cannot find symbol import android.app.Person. Is this because CN1 targets SDK 27, am I correct? Can I use some build hint to include a higher one that allows me to use android.app.Person?
Thanks
Seems it works when adding build hint android.buildToolsVersion=28
I'm working on a React Native project where we will need to build two different flavours of the app, which mostly the same but vary in a few small features. I wanted to see if there was a way to do this through babel somehow, by having different files named similarly for each build and triggering differetn builds by setting and environment variable. This would be similar to the way that React Native does for having custom js files for iOS and Android like this:
my-component.android.js
my-component.ios.js
so my different build flavours would look like this:
my-component.flavourA.js
my-component.flavourB.js
or even
my-component.flavourA.android.js
my-component.flavourB.android.js
my-component.flavourA.ios.js
my-component.flavourB.ios.js
I am trying to find a way of using babel to change the require() function (and import statements) such that the correct files are resolved from a simple require call of:
require('./my-component');
depending on which FLAVOUR environment variable is set. Or:
import * from './my-component';
I have looked at trying to use a combination of babel-plugin-module-resolver, babel-plugin-replace-require and babel-preprocessor but I'm not able to work out if this even possible without writing my own babel plugin.
Is there an easier way of achieving this that I am missing?
I need to change the default LKM File to Spark Knowledge Module in ODI 12c. Unfortunately, when I try to import it from /.../odi/sdk/xml-reference/component_kms/spark_python, nothing appears in the list of Knowledge Modules to import. Knowledge Modules do appear (though the wrong ones) when I look at /.../odi/sdk/xml-reference/.
Looking at the structure of the Spark KM XMLs, it appears different to the regular KMs.
Does anyone know if there is a way to import these modules to make it possible to copy/change them?
Components KM can not be imported / duplicated / modified / deleted. While the template-based KMs are just a template of code that you can edit and fine-tune, components KMs are based on java libraries and act more as black boxes. You can't create your own component KM. An editor for component KMs might be available in the future though.
If you really have to change something in the Spark KM, I guess your only solution is to create a new template-based KM for Spark.