How to update tags in packagist? - composer-php

I'm the owner of the package https://packagist.org/packages/lenny4/doctrine-merge-persistent-collection-bundle
When I look at the tag of my package I got this:
Lenny4 and doctrine-merge-persistent-collection-bundle where can I add/remove/update these tags ?

The list of tags is taken from your composer.json, specifically from the list of keywords you've defined in there.

Related

laravel proper way to extend(expand)/override specific vendor package file

the project I involved has composer require fengqi/hanzi into the vendor folder, which is used to convert simplified Chinese and traditional Chinese
For people who want to take a look at the package https://github.com/fengqi/hanzi
Inside the vendor folder, the package has the following example directory structure:
vendor/
--hanzi/
----src/
------Hanzi.php
------HanziDict.php
------Pinyin.php
The specific file HanziDict.php I want to modify has a really simple code structure:
<?php namespace fengqi\Hanzi;
return array (
'啊' => '啊',
...
...
'sample char A'=>'sample char B'
);
The github repository of the package suggested that I can insert any "char C => char D" inside the php file if I found the certain chars are missing from the dictionary.
But I believe I should not directly put the code inside vendor folder since it will be override after update.
So, my problem is how I can properly override/extend this file in Laravel (such as insert "char C => char D" into the array).
I already read and know how to properly extend class outside of vendor folder but did not find any useful information about other types of php files. I wonder if there is certain ways or rules to do with this kinds of files.
Ideally I want to achieve something like:
outside of the vendor folder, I have an expanded ExtraHanziDict.php. So it can always build upon the vendor dict.php.
The following links is the vendor class code (only fewer simple functions to read the dict and convert character)
https://github.com/fengqi/hanzi/blob/master/src/Hanzi.php (apology for throwing the code)
Unfortunately, in this case, there's no easy way to change the dictionary. As you correctly guessed you should never change the content of the vendor folder as it's not committed to version control.
In your specific case what you can do is:
Ask the repository mantainer to add an api that allows you to add new dictionaries at runtime.
Fork the repository, change what you need, and use that instead (see loading a custom git repository with composer). If you think your changes can be useful to others open a Pull request on the original repository.
There's no much logic on the repository you linked. Each package you add to your composer.json file is a burden, code that doesn't belongs to you and you MUST blindly thrust (what if at some point the repository is hacked and some malicious code hidden into it?). Just create your own service to do such a simple task.

jstl/jsp print name of file beutiful

I have my tag ${file.name} in a jsp file to display a name of file to download
name containt a full file name,include file extension. for example
testfile.png
a-file.zip
testfile-test505454654.png
a-filenum5468.docx
other_file_with_a_name_very_very_very_larrrrrrrrrrrrrrrrrrrrrge.pdf
Files with very long names, crash my layout.
I think the way to format the file name to shorten it but include the extention. Maybe
testfile.png
a-file.zip
testfile-test505454....png *
a-filenum5468.docx
other_file_with_a_na....pdf *
How I can do?
in href no problem because it is done by id ${file.id}
If file is a POJO, you may add a getter-method to the POJO (something like String getShortName(){}) that returns a short version of the file name. And then use the method in your EL expression: ${file.shortName}.
I would write and register a custom tag that would take care of shortening the output to a maximum length
<custom:short value="${file.name}" var="shortFileName" />
The tag would take care of shortening based on defaults or values you specify in the element and putting it the result in a request attribute you can use anywhere after that declaration.
Since the requirements can be used many times so You should go with CUSTOM Tag solution like #Sotirios Delimanolis suggested.
JSTL function ( Like c:fn ) is another solution. Using jstl function get better performance than Custom tag ( simple / classic model )
Link: http://www.noppanit.com/how-to-create-a-custom-function-for-jstl/

valueremapper does not read the csv file

Currently I'm strugling with the valueremapper option within the value replacer plugin of MAGMI. Somehow he get's the item id from my current column(Category_copy), but it does not map it to the correct value in the corresponding csv located on my website. (remapcategories.csv). It seems that he is not using the csv.
My case:
I create a new field category_ids. And as a value I put in:
{{
ValueRemapper::use_csv('http://mydomain.com/remapcategories.csv')->map({item.Category_copy})
}}
My csv file looks like this. There is no markup, no quotes and no heading (just like the magmi manual suggests)
HARDWARE|LAPTOPS;3
SOFTWARE|GAMES;5
I'm getting the following error message while uploading:
Invalid category ids found for sku 718037780566:HARDWARE|LAPTOPS
It seems that it does get the value from the Category_copy, but it won't map it to "3".
Any experienced magmi user who can help me here?
You should use "/" instead of |
Also do not use absolute path for your CSV
hope this helps

Parsing Jekyll's Categories

I have created a simple blog based on the Jekyll engine but I need one more function to make the thing really complete.
In Jekyll, parent directories of posts are implicitly 'labels' or 'categories'. So, if I were to create a post under the directory structure
/computers/scm/git
it would end up having 3 labels (computers, scm, git)
In my blog, I have created a few pages:
/computers/index.html
/computers/scm/index.html
/computers/scm/git/index.html
and these pages explicitly list posts in their respective categories such that /computers/index.html displays links to every post in /computers, /computers/sc and /computers/scm/git ... and likewise on down the road. Unfortunately, categories are not compound in Jekyll and so, "/computers/scm/index.html" iterates over the same set of posts as "/sandwiches/scm/index.html" …
Now, I'd like to automatically generate a sitemap listing all the categories, providing links to all of the pages I've created. Jekyll includes a construct "site.categories" that I can iterate over which works just great for all the top level categories. The problem is that when "scm" comes up, there is no "/scm/index.html" - it needs to be "/computers/scm/index.html".
I'm not sure I can fix this behavior - what type of extensions can I write to get both hierarchical categories and automatically generate a site map to my listing pages?
In my wildest dreams, I'd like to be able to tag a post as /a/b/c and have it associated with labels /a, /a/b and /a/b/c and then be able to generate pages that iterate over exactly these sets of posts. I need the site's organization to drill down from general to specific.
Do I need to try a different static generation engine?
You need to use Jekyll's plugins. For categories support in my blog I use one of this.
If you are Github Pages user, you must note that GP does not support plugins because of security reasons. To avoid this, you may use ideas from this blog post.
As an alternative, you can use Octopress, which is Jekyll-based.

Add contents of Dexterity NamedBlobFile to SearchableText

I've created a dexterity content type that has a NamedBlobFile as one of the fields (users will upload a .pdf). I'd like to have full-text indexing on that pdf -- like the ATFile type -- but not sure what I have to do to make that happen.
I've installed collective.dexteritytextindexer and have gotten some of the other fields added to searchable text by doing this:
searchable('paper_author')
paper_author = schema.Text(title=_(u"Author"), required=False)
I'm not sure what to do for the file field. Suggestions?
I think using the searchable() directive should work for NameBlobFiles too.
There is a converter in collective.dexteritytextindexer taking care of transforming the file contents into text so that it is indexable (see the code at github), which also applies for blobs (since the INamedBlobFileField subclasses INamedFileField for which the adapter is registered).
If it does not work its a bug, so please create an issue at the collective.dexteritytextindexer issue tracker.
If the problem is that the field is not defined in your code and you cannot use the searchable directive, there is also a searchable function (import from .utils!) which can be used outside the scope of the schema like this:
from plone.app.dexterity.behaviors.metadata import IBasic
from collective.dexteritytextindexer.utils import searchable
searchable(IBasic, 'title')
searchable(IBasic, 'description')

Resources