Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cmlewis
cmlewis / calculateDurationOfATask.java
Created October 30, 2014 21:08
Create a 'timer' in Java to measure the duration of some code in milliseconds and minutes.
// Get the current system time to calculate duration
long startTime = System.currentTimeMillis();
// Do logic here
// Get the end time and calculate duration
long endTime = System.currentTimeMillis();
long durationInMs = endTime - startTime;
long durationInMins = durationInMs/60000;
@cmlewis
cmlewis / AlfrescoExecuteUnlimitedSearch.java
Created October 30, 2014 14:58
Execute an Alfresco search with unlimited results and permissions checks. Bypasses the configured max search limit (default is 1000).
// Set up search params with unlimited results
SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_LUCENE); // Can be lucene, FTS, CMIS, etc.
sp.setQuery(query);
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setMaxItems(Integer.MAX_VALUE);
sp.setMaxPermissionChecks(Integer.MAX_VALUE);
// Execute query.
ResultSet resultSet = searchService.query(sp);
@cmlewis
cmlewis / Alfresco module (AMP) depends on another module
Created September 4, 2014 15:51
Make an Alfresco module/AMP depend on another module. When installing, the mmt install will require that the other modules are installed first.
_
@cmlewis
cmlewis / Using Alfresco RegexQNamePattern to get associations.md
Created August 29, 2014 16:26
Various methods using Alfresco's RegexQNamePattern to get associations

Various methods using Alfresco's RegexQNamePattern to get associations using:

  1. RegexQnamePattern.MATCH_ALL to get all associations
  2. Getting associations by name without a namespace
  3. Getting all associations in a particular namespace
@cmlewis
cmlewis / Delete SOLR index
Created August 14, 2014 20:39
Delete a SOLR index
http://HOST:PORT/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true
or
http://HOST:PORT/solr/CORE/update?stream.body=<delete><query>*:*</query></delete>&commit=true
@cmlewis
cmlewis / Trim video with ffmpeg - without reencoding.bat
Last active August 29, 2015 14:05
How to trim a video using ffmpeg (without reencoding)
rem Tell ffmpeg to copy the video and audio codecs and specify the start time (ss) and duration (t).
ffmpeg -i video.avi -vcodec copy -acodec copy -ss 00:00:00 -t 00:00:04 trimmed_video.avi
@cmlewis
cmlewis / Alfresco Content Model depends on a model from another AMP or module
Last active August 29, 2015 14:04
When deploying multiple AMPs/modules in Alfresco, content models may have dependencies on content models in other modules. Set up the proper dependencies using the dictionary bootstrap and 'depends-on' in your module-context.xml.
_
@cmlewis
cmlewis / Alfresco Share Action - View Object in Node Browser
Last active August 29, 2015 14:04
Alfresco Share action to view any object in Alfresco repository in the Share node browser. Admins can click this action to automatically bring up the node in the Share node browser instead of having to copy, paste, and search the noderef in the node browser.
Alfresco Share action that creates an action in the document library and document/folder details pages called 'View in Node Browser.' Admins can click this action to automatically bring up the node in the Share node browser instead of having to copy, paste, and search the noderef in the node browser.
@cmlewis
cmlewis / Rotate Videos using ffmpeg
Last active October 9, 2022 22:00
Rotate videos 90 or 180 degrees using ffmpeg
Rotate videos 90 or 180 degrees using ffmpeg.