can not exclude files from input in doxygen - c++

I want to generate a file list with gcc -M which delivers something like the following which works fine:
../active_var/timervar.h \
../active_var/universal_var.h \
../chrono_timer/chrono_timer.cpp \
/home/bla/foreign_components/gmock-1.7.0/fused-src/gmock/gmock.h \
/home/bla/foreign_components/gmock-1.7.0/fused-src/gmock-gtest-all.cc \
/home/bla/foreign_components/gmock-1.7.0/fused-src/gmock_main.cc \
/home/bla/foreign_components/gmock-1.7.0/fused-src/gtest/gtest.h \
../../mtp/index_tuple.h \
../observer/observer_with_stop_marker.h \
test_bugfixing.cpp \
test_counter.cpp \
I give this files to the
INPUT = <files as listed above >
This works as expected.
Now I simply want to ignore the files coming from /home/bla/foreign_components/
I tried:
EXCLUDE = */home/bla/foreign_components/*
or
EXCLUDE = /home/bla/foreign_components/
or
EXCLUDE = /home/bla/foreign_components/*
nothing works!
I tried the same with all above listed patterns with the EXCLUDE_PATTERNS
Also no effect.
Is this feature simply broken in doxygen or can files which are explicitly listed in files not be filtered out?
I am using doxygen version: 1.8.10

can files which are explicitly listed in files not be filtered out?
I think so.
You can generate your INPUT list by filtering gcc -M output:
gcc -M | grep -v "/home/bla/foreign_components"

Related

How to get latest version of an image from artifact registry

is there a command (gcloud) that return the latest fully qualified name of an image from Artifact registry
Try:
PROJECT=
REGION=
REPO=
IMAGE=
gcloud artifacts docker images list \
${REGION}-docker.pkg.dev/${PROJECT}/${REPO} \
--filter="package=${REGION}-docker.pkg.dev/${PROJECT}/${REPO}/${IMAGE}" \
--sort-by="~UPDATE_TIME" \
--limit=1 \
--format="value(format("{0}#{1}",package,version))"
Because:
Filters the list for a specific image
Sorts the results descending (~) by UPDATE_TIME1
Only takes 1 value i.e. the most recent
Outputs the results as {package}#{version}
1 -- Curiously, --sort-by uses the output (!) field name not the underlying type (surfaced by e.g. --format=json or --format=yaml) name.
Many thanks to the previous answer, I use it to remove the tag "latest" of my last pushed artifact. I then add it when I push another. Leaving here if anyone interested.
Doc : https://cloud.google.com/artifact-registry/docs/docker/manage-images#tag
Remove tag :
gcloud artifacts docker tags delete \
$(gcloud artifacts docker images list ${REGION}-docker.pkg.dev/\
${PROJECT}/${REPO}/${IMAGE}/\
--filter="package=${REGION}-docker.pkg.dev/${PROJECT}/${REPO}/${IMAGE}"\
--sort-by="~UPDATE_TIME" --limit=1 --format="value(format("{0}",package))"):latest
Add tag:
gcloud artifacts docker tags add \
$(gcloud artifacts docker images list \
${REGION}-docker.pkg.dev/${PROJECT}/${REPO}/${IMAGE}/ \
--filter="package=${REGION}-docker.pkg.dev/${PROJECT}/${REPO}/${IMAGE}" \
--sort-by="~UPDATE_TIME" --limit=1 \
--format="value(format("{0}#{1}",package,version))") \
$(gcloud artifacts docker images list \
${REGION}-docker.pkg.dev/${PROJECT}/${REPO}/${IMAGE}/ \
--filter="package=${REGION}-docker.pkg.dev/${PROJECT}/${REPO}/${IMAGE}" \
--sort-by="~UPDATE_TIME" --limit=1 \
--format="value(format("{0}",package))"):latest

Makefile: How do I concat, replace and put in a new file?

UPDATE
At the end, I came up with a lightening beautiful build Makefile. If you want take a look at this gist - https://gist.github.com/jonataswalker/5961bfcc0f335f3b51ea.
To concatenate some files I can do:
# JS files
JS_TARGETS = wrapper.js \
file1.js \
file2.js
combine-js:
#cat $(JS_TARGETS) > file-combined.js
But that's not what I want/need. My wrapper.js is like:
(function(Foo, win, doc){
'use strict';
/*{CODE_TO_BE_REPLACED}*/
})(window.Foo = window.Foo || {}, window, document);
So I need to put my other files inside wrapper.js. After that I will run jshint and uglify but this is another issue.
Simplest way would be splitting wrapper.js into two parts - head and tail - and then concatenating in strict order, e.g.:
cat wrapper_head.js file1.js file2.js wrapper_tail.js > file-combined.js
This should do it - it uses perl though:
JS_WRAPPED_SOURCES = file1.js file2.js
JS_WRAPPER = wrapper.js
JS_SOURCES = $(JS_WRAPPER) $(JS_WRAPPED_SOURCES)
combined.js: $(JS_SOURCES)
cat $< | perl -e '$$c=join("\n",<>); $$c =~ s/{CODE_TO_BE_REPLACED}/`cat $(JS_WRAPPED_SOURCES)`/e; print $$c' \
> $#
Since you're running jshint and uglify I'm guessing you're using Grunt.
In that case, I'd recommend you use a Grunt task like grunt-replace.

How to override template "folder_full_view_item.pt" only for a Custom Type?

This question has evolved in a confusing way. Some of its parts though, and specially some answers, might be useful for someone. Therefore I'll let this question unmodified and I'll try to reformulate the question here.
Overriding the template folder_full_view_item.pt with z3c.jbot will override the template for all Content Types.
How do I override it only for a single Content Type MyType in a Product with many types?
Having the following structure:
Folder (layout=folder_full_view)
Document (layout=document_view)
MyType (layout=mytype_view)
The default steps in Plone are:
The template folder_full_view.pt calls folder_full_view_item.pt via item.getObject().folder_full_view_item().
Products.CMFPlone's template folder_full_view_item.pt adds different ViewletManagers (abovecontenttitle etc.) and calls the item's layout via use-macro="item_macro".
The template of the item (document_view, mytype_view etc.) is included.
What I need is a way to override the template folder_full_view_item.pt. Calling in step #2 the overridden template folder_full_view_item.pt for MyType and Plone's folder_full_view_item.pt for all other Content Types.
UPDATE
It seems that the template folder_full_view_item.pt cannot be overriden (without using jbot). The call item.getObject().folder_full_view_item() in the template folder_full_view.pt doesn't seems to go through "queryMultiAdapter" neither.
I present here all the steps to reproduce it and confirm that folder_full_view_item is ignored:
Set the PLONE_HOME path and remove existing exaple.theme if necessary:
PLONE_HOME=/path/to/Plone-4.3.2
cd ${PLONE_HOME}/zeocluster/src
rm -rf ${PLONE_HOME}/zeocluster/src/example.theme
sed -i '/example\.theme/d' ${PLONE_HOME}/zeocluster/buildout.cfg
run buildout with develop.cfg:
sudo -u plone_buildout ${PLONE_HOME}/zeocluster/bin/buildout -c ${PLONE_HOME}/zeocluster/develop.cfg
cd ${PLONE_HOME}/zeocluster/src
rm -rf /home/Plone-4.3.2/zeocluster/src/example.theme
sudo -u plone_buildout ${PLONE_HOME}/zeocluster/bin/paster create \
--no-interactive \
--overwrite \
-o ${PLONE_HOME}/zeocluster/src \
-t plone3_theme example.theme \
expert_mode=all \
namespace_package=example \
package=theme \
skinname='ExampleTheme' \
skinbase='Sunburst Theme' \
empty_styles=False \
include_doc=True \
version=1.0 \
description='An installable theme for Plone 3' \
add_profile=True \
long_description= \
author= \
author_email= \
keywords='web zope plone theme' \
url='http://svn.plone.org/svn/collective/' \
license_name=GPL \
zip_safe=False \
zope2product=True
add example.theme to buildout:
sed -i '79i\ \ \ \ example.theme' ${PLONE_HOME}/zeocluster/buildout.cfg
sed -i '102i\ \ \ \ src/example.theme' ${PLONE_HOME}/zeocluster/buildout.cfg
register browser:pages
cat << EOF > ${PLONE_HOME}/zeocluster/src/example.theme/example/theme/configure.zcml
<configure
xmlns:browser="http://namespaces.zope.org/browser"
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:cmf="http://namespaces.zope.org/cmf"
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="example.theme">
<five:registerPackage package="." initialize=".initialize" />
<include package=".browser" />
<include file="skins.zcml" />
<include file="profiles.zcml" />
<i18n:registerTranslations directory="locales" />
<browser:page
for="*"
name="folder_full_view_item"
template="folder_full_view_item.pt"
layer="example.theme.browser.interfaces.IThemeSpecific"
permission="zope2.View"
/>
<browser:page
for="Products.ATContentTypes.content.folder.ATFolder"
name="folder_full_view"
template="folder_full_view.pt"
layer="example.theme.browser.interfaces.IThemeSpecific"
permission="zope2.View"
/>
<browser:page
for="Products.ATContentTypes.content.document.ATDocument"
name="document_view"
template="document_view.pt"
layer="example.theme.browser.interfaces.IThemeSpecific"
permission="zope2.View"
/>
</configure>
EOF
copy original files (document_view.pt, folder_full_view.pt, and folder_full_view_item.pt) to theme:
cp -f ${PLONE_HOME}/buildout-cache/eggs/Products.CMFPlone-4.3.2-py2.7.egg/Products/CMFPlone/skins/plone_content/document_view.pt \
${PLONE_HOME}/zeocluster/src/example.theme/example/theme/document_view.pt
cp -f ${PLONE_HOME}/buildout-cache/eggs/Products.CMFPlone-4.3.2-py2.7.egg/Products/CMFPlone/skins/plone_content/folder_full_view_item.pt \
${PLONE_HOME}/zeocluster/src/example.theme/example/theme/folder_full_view_item.pt
cp -f ${PLONE_HOME}/buildout-cache/eggs/Products.CMFPlone-4.3.2-py2.7.egg/Products/CMFPlone/skins/plone_content/folder_full_view.pt \
${PLONE_HOME}/zeocluster/src/example.theme/example/theme/folder_full_view.pt
slightly modify overriden templates to recognize them:
sed -i '/<metal:content-core define-macro="content-core">/a overriden template at '${PLONE_HOME}'/zeocluster/src/example.theme/example/theme/document_view.pt' \
${PLONE_HOME}/zeocluster/src/example.theme/example/theme/document_view.pt
sed -i '/<metal:entries fill-slot="entries">/a overriden template at '${PLONE_HOME}'/zeocluster/src/example.theme/example/theme/folder_full_view.pt' \
${PLONE_HOME}/zeocluster/src/example.theme/example/theme/folder_full_view.pt
sed -i '/<div tal:replace="structure provider:plone.abovecontenttitle" \/>/i overriden template at '${PLONE_HOME}'/zeocluster/src/example.theme/example/theme/folder_full_view_item.pt' \
${PLONE_HOME}/zeocluster/src/example.theme/example/theme/folder_full_view_item.pt
chown -R plone_buildout example.theme
run buildout and start plone:
sudo -u plone_buildout ${PLONE_HOME}/zeocluster/bin/buildout -c ${PLONE_HOME}/zeocluster/develop.cfg
${PLONE_HOME}/zeocluster/bin/zeoserver restart
${PLONE_HOME}/zeocluster/bin/client1 fg
If you want to programmatically create test data (e.g. from ipython) then you could do the following:
utils.sync()
plone_site_name = 'Plone'
# delete 'Plone' site if existing
if app.hasObject(plone_site_name): app.manage_delObjects(plone_site_name)
from Products.CMFPlone.factory import addPloneSite
# create 'Plone' site
plone_site = addPloneSite(
app,
plone_site_name,
profile_id=('Products.CMFPlone:plone',),
extension_ids=('plonetheme.classic:default',
'plonetheme.sunburst:default',),
setup_content=False,
)
plone_site = app[plone_site_name]
# install 'plone.app.theming' and 'example.theme'
plone_site.portal_quickinstaller.installProduct('plone.app.theming')
plone_site.portal_quickinstaller.installProduct('example.theme')
# create some content
plone_site.invokeFactory('Document', 'document')
folder_id = plone_site.invokeFactory('Folder', 'folder')
plone_site[folder_id].setLayout('folder_full_view')
plone_site[folder_id].invokeFactory('Document', 'document')
utils.commit()
UPDATE 2
Adding the following as suggested doesn't work either:
define a subclass from zope.interface.Interface:
cat << EOF >> ${PLONE_HOME}/zeocluster/src/example.theme/example/theme/browser/interfaces.py
from zope.interface import Interface
class IMyLayer(Interface):
""" """
EOF
register it as a browser layer:
cat << EOF > ${PLONE_HOME}/zeocluster/src/example.theme/example/theme/profiles/default/browserlayer.xml
<?xml version="1.0"?>
<layers>
<layer name="imylayer" interface="example.theme.browser.interfaces.IMyLayer" />
</layers>
EOF
register the browser:page for this layer:
sed -i 's/layer="example.theme.browser.interfaces.IThemeSpecific"/layer="example.theme.browser.interfaces.IMyLayer"/' \
${PLONE_HOME}/zeocluster/src/example.theme/example/theme/configure.zcml
UPDATE 3
The call item.getObject().folder_full_view_item() seems not to go through the "usual" layers!
I've tested the following with the example above:
in folder_full_view substitute the call item.getObject().folder_full_view_item() with item.getObject().document_view()
modify the original document_view.pt
echo "original document_view" > ${PLONE_HOME}/buildout-cache/eggs/Products.CMFPlone-4.3.2-py2.7.egg/Products/CMFPlone/skins/plone_content/document_view.pt
modify the document_view.pt in example.theme
echo "overriden document_view" > /home/Plone-4.3.2/zeocluster/src/example.theme/example/theme/document_view.pt
calling the document uses the overriden document_view.pt
curl -s 'http://localhost:8080/Plone/document' | grep "document_view"
overriden document_view
but calling the folder (with a document in it) uses the original document_view.pt
curl -s 'http://localhost:8080/Plone/folder' | grep "document_view"
original document_view
Thus the central questions seem to be:
goes the call item.getObject().template_name() in a template through the "usual" publishing/layers process?
If not, how to call a template like folder_full_view_item form folder_full_view and make it go trough the "usual" publishing/layers process?
Can someone give a hint for which part of zope/plone is responsible for this "publishing/layers process"?
Instead of overriding folder_full_view_item.pt you should rather create your own custom default template for your Content Type MyType.
Try using tal:condition="python:item_type=='MyType'" and item_type!='MyType' for different display needs. Hope this helpful.
To override this template you will need 2 things: a browser layer and the view that is going to be used in the context of your content type.
First, declare the browser layer:
from zope.interface import Interface
class IMyLayer(Interface):
"""A layer specific for this add-on product.
"""
This browser layer needs to be installed with your content type. Create a browserlayer.xml file with the following:
<?xml version="1.0"?>
<layers>
<layer name="my.type" interface="my.type.interfaces.IMyLayer" />
</layers>
Then, the view will be active when you are in the context of your content type and when your browser layer is active:
from five import grok
class FolderFullViewItem(grok.View):
"""Override folder_full_view_item for MyType.
"""
grok.context(IMyType)
grok.layer(IMyLayer)
grok.name('folder_full_view_item')
grok.template('folder_full_view_item')
grok.require('zope2.View')
On sc.blog we have a similar use case on which we override folder_summary_view and folder_full_view, take a look on it.
Also, don't forget to read the Layers chapter on the Plone Developers Documentation.
As the skins-tool seems to be deprecated and probably performance-losses would be involved, I'd rather go with a dedicated browser-view for your custom-contenttype, too, but to answer the question:
You can use collective.editskinswitcher (thanks to M. v. Rees!), without rewriting too much and even getting some nice and easy to configure dev-features along the way (visitors-view, while actually logged-in, via URL-distinction, e.g.).
In this case, we take advantage of the possibility to set the skin-property on a folderish contenttype-object and roughly, these steps should make the deal:
Place the customized folder_full_view_item.pt -template in any of your theme's skin-folders.
On creation of your contenttype, add an event-listener, which sets the freshly born object's skin_name to your theme's skin-name (have a look at c.editskinswitcher for methods and props, the referring HTTP-request is ##switchDefaultSkin?skin_name=YourTheme, btw).
Set another theme-skin as the global default for all other contextes in portal_skins-properties.

Unix CLI script to rename folders using their pre-existing names

I have a directory with folder structure as follows:
-- DATA -- ABD 1231345 -- 01-08-12 // date in mm-dd-yy format
-- 03-09-12
-- 06-11-12
-- DEF 4859480 -- 02-10-12
-- 05-10-12
-- 07-10-12
I would like to batch rename this DATA folder as follows
-- DATA -- ABD 1231345 -- 2012_01_08 // date in yyyy_mm_dd format with underscore
-- 2012_03_09
-- 2012_06_11
-- DEF 4859480 -- 2012_02_10
-- 2012_05_10
-- 2012_07_10
Do you have a suggestion on how to accomplish using command line on Mac OSX / unix?
You could use a for loop and awk, parsing each file-name into your specified format and then mv to rename the original to the new name:
for dir in DATA/*; do \
pushd "$dir"; # change directory \
for file in *; do \
path=`echo $file | awk -F- '{print "20"$3"_"$1"_"$2}'`; \
mv $file $path; # "rename" the file \
done; \
popd; # restore original directory \
done;
This can be executed in folder above DATA. If you want to execute it directly in DATA, update the first loop to read for dir in *; do instead of DATA/*. It tells awk to use the - as the delimiter (instead of whitespace), and then reconstructs a string from "mm-dd-yy" to "20yy_mm_dd".
Using pushd and popd will enable the script to change the current directory to each subdirectory inside DATA (pushd) and then, after moving all necessary files will change back to the original (popd). Doing this will save you a lot of parsing-effort trying to save directory paths / etc.
You could use string manipulations and arrays to do that with bash only.
Something like:
for f in * ; do
parts=(${f//-/ })
mv "$f" "20${parts[2]}_${parts[1]}_${parts[0]}"
done
Search this site for various options to recurse into directories e.g.:
Shell script to traverse directories
Use the date command to convert the file name:
$ date -j -f %m-%d-%y 01-08-12 +%Y_%m_%d
2012_01_08
Getting to the files is a little tricker. We'll just switch directories to avoid dealing with long file paths.
for d in DATA; do
pushd "$d"
for f in *; do
new_f=$(date -j -f %m-%d-%y $f +%Y_%m_%d)
mv "$f" "$new_f"
done
popd
done
This site gives a good snippet
for i in *.avi; do j=`echo $i | sed 's/(\d{2})-(\d{2})-(\d{2})/20\3_\1_\2/g'`; mv "$i" "$j"; done

Multiple Photos upload on Facebook

Is there any way to upload multiple photos together on facebook...
I have uploaded a single photo at a time using GraphAPI....but not multiple...
Please suggest...
Thanks...
You need to place a "batched" request to the Graph API. This is documented here: https://developers.facebook.com/docs/reference/api/batch/ (check out the paragraph "Uploading binary data"). Basically it's a cURL call where you json encode an array containing all the "batched" requests ("batch=[json array of calls]"). For some good reson Facebook limits your array to 20 requests. It translates pretty nicely to the PHP cURL methods, if you've got cURL enabled on your server...
curl
–F 'access_token=…' \
-F 'batch=[{"method":"POST", \
"relative_url":"me/photos", \
"body":"message=My cat photo" \
"attached_files":"file1" \
},
{"method":"POST", \
"relative_url":"me/photos", \
"body":"message=My dog photo" \
"attached_files":"file2" \
},
]’
-F 'file1=#cat.gif' \
-F 'file2=#dog.jpg' \
https://graph.facebook.com
UPDATE: replaced “ with " and ‘ with '