docpad-plugin-thumbnails appears to hang - docpad

Symptom...
docpad run results in the usual messages but it never gets past:
Currently on writeFiles at 45/45 100% =================================================
Environment -
osx 10.8.3
node v0.10.0
npm i.2.14
docpad 6.34.2
ImageMagick v6.8.5-3, which has been confirmed working from the command line
Steps to reproduce...
Install kitchensink skeleton (or the jade and adapt the coffeekup code in example)
Install docpad-plugin-associatedfiles
and docpad-plugin-thumbnails
Create an associate-files directory in Files and drop in another directory called 'gallery' with some .jpg's with no spaces in the filenames
Create a new page called gallery.html.coffee and cut and paste the coffeeKup example from thumbnails' read me file :) - see below.. [I've also tried simplifying it down to the bare functionality to show the thumbnails, by cutting out the checks on file-types and the links to the original sized images.]
docpad run and watch whilst it doesn't finish...
Observations -
If you remove the reference to getThumbnails and just list the associated files it all works peachy.
Filenames for the thumbnails that would be generated show up in the generated HTML file - but the thumbnails do not show up in the out directory (or anywhere else as far as I could find)
So questions...
am I missing the startlingly obvious? (here's hoping)
how do I inspect docpad.log?
I read the instructions for debugging, but so far I've not made sense of them enough to step into any code - sorry - I'm a real novice.
Thanks for any input,
The page looks like this:
---
layout: default
title: Gallery
---
image_exts = ['jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG']
images = #getDocument().getAssociatedFiles().findAll({extension: $in: image_exts}).toJSON()
for image in images
a href: image.url, -> img src: #getThumbnail(image.url, w: 100, h: 100), alt: image.name

I had the same problem, and I used the command:
$ docpad --debug 7 run
If you get the error "spawn ENOENT", you must install graphicsmagick, because the gm library needs some configuration if you use imagemagick.

You can try this command:
npm install --save docpad-plugin-thumbnails
I was facing the similar issue and it worked for me.. hope this helps!

Did you configure the plugin to use imageMagick in your docpad.coffee?
plugins:
thumbnails:
imageMagick: true

Related

How to package a Kivy app with Pyinstaller

I have a lot of troubles following the instructions form the Kivy website, many steps aren't explained like what should I answer to the warning.
WARNING: The output directory "..." and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)
Even if I choose y, the folder isn't removed.
Also should I always add these lines:
from kivy.deps import sdl2, glew
Tree('C:\\Users\\<username>\\Desktop\\MyApp\\'),
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)]
in the .spec file? Why are they necessary?
Not many info is available for Kivy.
Because I spent a lot of time understanding how I should package my app, here are some instructions that would have really helped me.
Some info are available at http://pythonhosted.org/PyInstaller/
Python 3.6 as of march 2017
Because packaging my app gave me the error IndexError: tuple index out of range, I had to install the developement version of PyInstaller:
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
Step 1:
I moved all the files of MyApp in a folder "C:\Users\<username>\Desktop\MyApp": the .py, the .kv and the images and I created an icon.ico.
I created another folder C:\Users\<username>\Desktop\MyPackagedApp. In this folder I press Shift+right click and select open command window here.
Then I pasted this:
python -m PyInstaller --name MyApp --icon "C:\Users\<username>\Desktop\MyApp\icon.ico" "C:\Users\<username>\Desktop\MyApp\myapp.py"
This creates two folders, build and dist, and a .spec file. In dist/MyApp, I can find a .exe. Apparently, if my app is really simple (just one label), the packaged app can works without the Step 2.
Step 2:
The second step involves editing the .spec file. Here is an exemple of mine.
(cf Step 3, for the explanations about my_hidden_modules)
I go back to the cmd, and enter
python -m MyApp myapp.spec
I then got this warning:
WARNING: The output directory "..." and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)
I enter y and then press enter.
Because I choosed y, I was surpised that the folder build was still there and that the dist/MyApp was still containing many files. But this is normal. PyInstaller can output a single file .exe or a single folder which contains all the script’s dependencies and an executable file. But the default output is a single folder with multiple files.
Step 3: adding hidden modules
When I click on the myapp.exe in dist/MyApp, the app crashed. In the log C:\Users\.kivy\logs\ I could find 2 errors: ModuleNotFoundError: No module named 'win32timezone' and SystemError: <class '_frozen_importlib._ModuleLockManager'>.
Because of this I had to edit the .spec file and add these lines:
my_hidden_modules = [
( 'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\site-packages\\win32\\lib\\win32timezone.py', '.' )
]
in a = Analysis I changed datas = [] to datas = my_hidden_modules,
Apparently this is because I used a FileChooser widget.
So, the line:
ALL ITS CONTENTS will be REMOVED!
yes, it will be removed AND replaced later with new files. Check the date. I think it prints permission denied if it can't do such a thin both for files and the whole folder, so you'd notice it. It's important though, because you need to add additional files into your folder.
Those additional files of two types:
kivy dependencies
application data
Dependencies are just binaries (+/- loaders, licenses, or so), you get them through the *[Tree(p) ...] piece of code, which is just a command for "get all files from that folder". Without them Kivy won't even start.
Similarly to that, the second Tree(<app folder>) does the same, but for your own files such as .py files, .kv files, images, music, databases, basically whatever you create.
Obviously if you remove the deps, app won't start and if you remove app data, you'll get some path errors and most likely crash. You don't want any of that :P
It also works if in the 'a = Analysis...' block in the spec file one substitutes
hiddenimports=[]
for
hiddenimports=['win32file', 'win32timezone']
for win32file, win32timezone or for whatever files are missing

Fix Quick Look for TypeScript files

My Mac recognises the .ts extension as MPEG-2 Transport Stream, while I use it more often as TypeScript files. Because of that Quick Look does not show the contents of .ts files.
I found on Stackoverflow that I should be able to assign custom extensions to the text editor, but I'm not sure how.
QLColorCode is a very nice Quick Look plugin which allows you to set syntax highlighting for ANY extension file you want.
1. Install QLColorCode Quick Look plugin
If you have Homebrew, you can install it with:
brew cask install qlcolorcode
Otherwise, you can just copy / paste the QLColorCode.qlgenerator to your ~/Library/QuickLook/ folder from a release.
2. Add .ts and .tsx syntax highlighting support
First get the kMDItemContentType of the extension you want to quick look at with the plugin:
mdls -name kMDItemContentType /path/to/any/file.ts
Add an entry with the string returned by the previous command to the plugin settings list — for a .ts file, this should be public.mpeg-2-transport-stream. To do so, just open the file ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/Info.plist with any text editor (it's not a compiled file) and in the section CFBundleDocumentTypes > Item 0 > LSItemContentTypes (~ 15th line), add a line like this:
<string>public.mpeg-2-transport-stream</string>
You can find more information on how to add language type support to the plugin in the project README.md.
Here is the original post where I found all this useful information.
According this article, there is another solution:
1) Remove filetype definition from: /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist
You need to do that in recovery mode.
215 => {
"UTTypeConformsTo" => "public.movie"
"UTTypeDescription" => "MPEG-2 Transport Stream"
"UTTypeIdentifier" => "public.mpeg-2-transport-stream"
"UTTypeTagSpecification" => {
"public.filename-extension" => [
0 => "ts"
]
}
}
2) Then run
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill
I managed to get QuickLook to display .ts files as plain text.
The necessary step was to remove Movie.qlgenerator from the directory /System/Library/QuickLook.
The downside is, that QuickLook can't preview any types of movies any more...
Update 2016-04-12:
In OSX El Capitan it seems not possible to simply remove a file from /System/Library/QuickLook (probably because of System Integrity Protection).
I managed to remove the Movie.qlgenerator with the following steps:
Back up the file first
Boot into Recovery Mode: Restart and press-and-hold Cmd-R
Open a terminal
disable SIP: csrutil disable
cd /Volumes/Macintosh HD/System/Library/QuickLook (your volume name may be different)
rm -rf Movie.qlgenerator
csrutil enable
csrutil status -> Verify SIP is turned on again
Restart
After the above steps I could quick-look my .ts files.
The best part: I put the Movie.qlgenerator I had backed up in the first step into ~/Library/QuickLook and now I have also quick-look previews for movies ...

Three.JS plugin for Blender not working

I cannot install the Three.js plugin for Blender. I have a Fedora with Blender 2.69, I created the directory io_mesh_threejs in /usr/share/Blender ... /addon and copied the 3 .py files into but the plugin doesn't appear in the user preference.
I also tried with a downloaded 2.65 version of Blender with no success.
I did it for another library (Babylon.js) and it worked fine so I guess it comes from the python files ?
Here is what I did to get it to work with Win 7 - may work for you also.
Make sure you copy the text from the Raw File format instead of just right clicking and downloading the python files. If you right click and download you might get some additional html code that will break it. Someone else here made that suggestion previously.
Put the import and export files in the io_mesh_threejs folder. Put the init file in the root of the addons directory.
That did the trick for me anyway.
hopefully this adds to the conversation stream ... I've spent two hours finding this answer myself for IFC file imports for Blender ... I've just now got there ... I'm on a Mac with OSX and my Blender 2.71 is positioned in /Users/username/Documents/Blender ... I tried the User Preferences to no avail ... even followed the PATH to /Users/username/Library/Application Support/Blender/2.71/scripts/addons and manually copied the files in using shell ... still nothing ... then I found that the actual place they should go is
/Users/username/Documents/Blender/blender.app/contents/MacOS/2.71/scripts/addons
In my case for IFCBlender I then made a directory called
bash$ mkdir io_scene_ifc
Then I copied in the all the downloaded files ... Hooray this now appeared in my User Preferences ...

symfony2 assetics yui compressor on windows (path syntax)

I'm trying to get assetics running with the yui compressor and, if this is running, sass. Right now, both don't work. When removing all filters from config.yml and the twig template, it works and php app/console assetic:dump does copy the css and js files.
Now I want to add the yui compressor and my config.yml looks like this:
assetic:
debug: %kernel.debug%
use_controller: false
filters:
yui_js:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar
Adding the filter to the template and running assetic:dump again ends in the following error (translation of message by me):
[RuntimeException]
The syntax for filename, directory name or drive name is wrong
I found an article telling me to specify the path to java.exe, so I add this to config.yml:
assetic:
..
java: C:/Program Files (x86)/Java/jre6/bin/java.exe
..
Now assetic:dump tells me:
[RuntimeException]
The COMMAND "C:/Program" is either written wrong or
I tried playing around with both variables (using \ or \ instead of /, adding single or double quotes, working with short alias Progra~1 or Progra~2) in the config, but I didn't get anywhere. The both errors comming up all the time. Maybe someone can point me in the right direction.
Ok, I figured it out. Man, this one was brutal.
Let's start with the easy stuff. A working version of the config.yml can look like this:
assetic:
debug: false
use_controller: false
java: C:\Program Files (x86)\Java\jre6\bin\java.exe
sass: C:\Program Files (x86)\Ruby192\bin\sass.bat
filters:
scss: ~
yui_js:
jar: %kernel.root_dir%\Resources\java\yuicompressor-2.4.6.jar
For some reason, assetic is always importing a whole directory for scss, so I had to make a combine.scss which imports the other scss files in the correct order.
And now it gets ugly, as one have to change the assetics core in order to get this working. The developers of assetic know this bug and I think it is fixed in some development trunk/branch but not the stable one.
The Assetic\Util\ProcessBuilder has to be changed on line 95
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
,line 103
$script .= ' '.implode(' ', array_map('escapeshellarg', $args));
and line 110
return new Process($script, $this->cwd, null, $this->stdin, $this->timeout, $options);
I hope this bug get fixed soon and till then anybody trying to get it working finds this thread... Took me like 8 hours of debuging, reading and trying different approaches.
Answer by Boo Nov 19 at 22:53 did work for me by changing everything he mentioned in Assetic\Util\ProcessBuilder (I ignored line 95 as it looks the same as in my file)
Now it works on windows. Thanks!
Just to confirm. Im using Symfony 2.0.7 and yuicompressor-2.4.7
For other users who use window server 2008 r2 :
Maybe you should change the C:\windows\Temp folder property to 777 (read/write) for the IIS user / or the machine's normal user
please unpack the ruby.7z from rubyinstaller.org , and go to C:\_ruby193\bin , in this unpack position you should exec the CMD prompt , type :
ruby -S gem install sass
so that you will get the sass.bat in that position
It's time to use Boo's best answer , and please notice that in symfony2 dev env maybe it's not necessary to change the use_controller to false (in the config.yml) , because there's another use_controller in the config_dev.yml (set to true) , and in routing_dev.yml there's also a _assetic router , they're perhaps associated.

Missing xml tag SVG file (using Graphviz dot.exe)

My config is:
- Windows Vista
- XAMPP 1.7.1
- Media Wiki + Semantic MW
- an extension that uses Graphviz to create a SVG
- Graphviz 2.26.3 (install dir c:\graphviz.....)
Everything works fine but the problem is: the xml tag
'image xlink:href="some_image.png"....'
is missing from the SVG file created using a Media Wiki php page.
This is done by:
$cmdlinesvg = wfEscapeShellArg($cmd).' -T svg '.wfEscapeShellArg($src).' -o '.wfEscapeShellArg($svg);
$WshShell = new COM("WScript.Shell");
$WshShell->Exec($cmdlinesvg);
I've created a batch file that executes the same command line:
c:\graphviz2.26.3\bin\dot.exe -T svg filename.dot -o filename.svg
and if I run it manually it works, and the xml tag appears.
Anyone knows what is the problem? thanks in advance.
SOLVED
The problem is related to the image path that is in the .DOT file.
If you run the command line manually, the image path doesn't need to be a full path.
You can have only: shapefile="some_image.png"
If you run the command inside php code, the image path HAS to be a full path.
So you must have: shapefile="C:\xampp......\some_image.png"
Another problem arises: the resulting .SVG file doesn't show the images.
If you right-click and open the .SVG file with the browser (ie Firefox), the images are ok.
But, again, through a php page, the images are lost.
Solution: edit the .SVG file (this is XML) to change the paths.
On the original .SVG file we have:
On the modified .SVG file we must have:
PS: I'm doing my master thesis, so this is for a particular problem, but still I hope it helps someone.

Resources