PHPExcel_Settings::setCacheStorageMethod alternative in PhpSpreadsheet - phpexcel

I have this lines in my previous code
$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
$cacheSettings = array( 'memoryCacheSize' => '32MB');
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
Now I am trying to migrate to PhpSpreadsheet.
I am able to find class \PhpOffice\PhpSpreadsheet\Settings and methods setCache() and getCache(). But still not able find this options what i have.
Can anyone provide a way or an example to do what i am doing in PHPExcel into PhpSpreadsheet.

Caching was rewritten in PhpSpreadsheet (see documentation). If you need other caching options, you have to write your own PSR-16 cache or use one of the libraries mentioned in the documentation.

Related

how to write syntax for key value fair symfony console

I want to update inventory based on sku.
For example
php magento update_inventory --sku&quantity=array(1001,10) --sku&quantity=array(1002,20) --sku&quantity=array(1003,30)
But I’m not getting how to add options/arguments ?
here user at least need to provide one pair (sku& quantity).
for this i think i have to use ArrayInput class/InputArgument/InputOption.
Can you give some solution or reference to above requirement?
Have you looked at how Magento\Setup\Console\Command\AdminUserCreateCommand uses options? Take a look at how that code uses getOptionsList in the configure method. For your use case you may want to look into using InputOption::VALUE_IS_ARRAY
A good reference will be http://symfony.com/doc/current/components/console/introduction.html#using-command-options
You may also want to consider a different input format. For example using arguments instead of options and specifying the format in documentation.
php magento update_inventory 1001:10 1002:20 1003:30

RssDisplay Extension / Simple Pie

I'm just a little desperate.
I installed the RSS Display extension.
http://typo3.org/extensions/repository/view/rss_display
Everything works fine, but I have just a little understanding problem.
I pull myself with fluid the Author for the current feed.
<feed:item.get value="author"/>
Than i look whats inside.
<f:debug><feed:item.get value="author"/></f:debug>
Thats the result.
SimplePie_Author prototype object
name => 'Name Name' (12 chars)
link => NULL
email => NULL
So what i need it's to get the name of the author.
Unfortunately i am not able to get the value.
I am really new in Fluid, Typo3.
Hopefully someone can help me.
One way to do this, is to create a fluid variable author and assign the author object to it. Then you can access the name using {author.name}.
To create a variable, you could use the ViewHelper <f:alias>, like this:
<f:alias map="{author: '{feed:item.get(value: \'author\')}'}">
{author.name}
</f:alias>
Another way would be to use the extension "vhs", which provides many tools for use with fluid. One of these tools is the ViewHelper <v:variable.set>, which could be used like this:
<v:variable.set name="author" value="{feed:item.get(value: 'author\'}"/>
{author.name}
This has the advantage that you don't need to use the variable within the tags of the ViewHelper.
There are other ways to reach the same goal, without defining variables, but this seems to be the easiest one to me.

Plone Conditional - If Content Type is Versionable

Is there a simple way to check if a content-type, or a specific object, has Versioning enabled/disabled in Plone (4.3.2)?
For context, I am making some unique conditionals around portal_actions. So instead of checking path('object/##iterate_control').checkout_allowed(), I need to first see if versioning is even enabled. Otherwise, the action in question does not display for items that have versioning disabled, because obviously it isn't checkout_allowed.
I didn't have any luck with good ole Google, and couldn't find this question anywhere here, so I hope it's not a dupe. Thanks!
I was able to get this working by creating a new script, importing getToolByName, and checking current content type against portal_repository.getVersionableContentTypes(). Then just included that script in the conditional.
I was looking for something like this that already existed, so if anyone knows of one let me know. Otherwise, I've got my own now. Thanks again!
The first thing that checkout_allowed does is check if the object in question supports versioning at all:
if not interfaces.IIterateAware.providedBy(context):
return False
(the interface being plone.app.iterate.interfaces.IIterateAware:
class IIterateAware( Interface ):
"""An object that can be used for check-in/check-out operations.
"""
The semantics Interface.providedBy(instance) are a bit unfortunate for usage in conditions or TAL scripts, because you'd need to import the interface, but there's a reversal helper:
context.portal_interface.objectImplements(context,
'plone.app.iterate.interfaces.IIterateAware')

How to start working on as3yaml?

I am a newbie in yaml but I have to work on as3yaml which I don't have any knowledge on it.
I already downloaded as3yaml and attached to my project which is Flex project and I already read about yaml syntax.
But I don't have any ideas how can I start to work on it. I don't know how to new .yaml file with eclipse. I can't find any .yaml new file.
For now I understand that I have to create .yaml file and have to write the function on Actionscript Class to encode/decode the .yaml file.
And I also need some get started websites which I can learn myself.
Pls help!
I've never used Yaml as well, however it seems pretty straightforward:
var yaml:YAML = new YAML();
var data:Object = YAML.decode(yourYamlString);
You should really try reading the docs. Also, I wouldn't recommend using YAML unless you really have to. If you can, use AMF (native, faster, parses directly into model) but if you want something a little more 'web standardized' you can use JSON with the as3core library to parse it.

How to work with hook_nodeapi after image thumbnail creation with ImageCache

A bit of a followup from a previous question.
As I mentioned in that question, my overall goal is to call a Ruby script after ImageCache does its magic with generating thumbnails and whatnot.
Sebi's suggestion from this question involved using hook_nodeapi.
Sadly, my Drupal knowledge of creating modules and/or hacking into existing modules is pretty limited.
So, for this question:
Should I create my own module or attempt to modify the ImageCache module?
How do I go about getting the generated thumbnail path (from ImageCache) to pass into my Ruby script?
edit
I found this question searching through SO...
Is it possible to do something similar in the _imagecache_cache function that would do what I want?
ie
function _imagecache_cache($presetname, $path) {
...
...
// check if deriv exists... (file was created between apaches request handler and reaching this code)
// otherwise try to create the derivative.
if (file_exists($dst) || imagecache_build_derivative($preset['actions'], $src, $dst)) {
imagecache_transfer($dst);
// call ruby script here
call('MY RUBY SCRIPT');
}
Don't hack into imagecache, remember every time you hack core/contrib modules god kills a kitten ;)
You should create a module that invokes hook_nodeapi, look at the api documentation to find the correct entry point for your script, nodeapi works on various different levels of the node process so you have to pick the correct one for you (it should become clear when you check the link out) http://api.drupal.org/api/function/hook_nodeapi
You won't be able to call the function you've shown because it is private so you'll have to find another route.
You could try and build the path up manually, you should be able to pull out the filename of the uploaded file and then append it to the directory structure, ugly but it should work. e.g.
If the uploaded file is called test123.jpg then it should be in /files/imagecache/thumbnails/test123/jpg (or something similar).
Hope it helps.

Resources