Plone date translations broken - internationalization

Somehow after running buildout and restarting my website, dates translations are not correct. I receive 28 month_aug_abbr 2015, not 28 Aug 2015.

When this happens I usually check zope.conf.
It should include this environment variables:
PTS_LANGUAGES it en
LANG it_IT.utf8
TZ Europe/Rome
zope_i18n_compile_mo_files true
You can configure them with buildout doing something like this:
[instance-settings]
environment-vars +=
PTS_LANGUAGES it en
LANG it_IT.utf8
TZ Europe/Rome
zope_i18n_compile_mo_files true
If you use complex buildouts you should pay attention to the presence of lines with "environment-vars =" (note the missing + before the equal): they may override your modification.
Use ./bin/buildout annotate to debug your buildout.

Related

Ho do I set system timezone to UTC so that joda DateTime doesn't ignores it?

I'm using Scala along with play framework. So I've set my system timezone to UTC:
sudo systemsetup -gettimezone
Time Zone: GMT
But
println(DateTime.now().toString)
results into "2018-10-10T19:29:40.886+02:00" and all of the dates I operate in my code keep my actual timezone unless I set it manually by withZone. How do I set my system date properly? Would appreciate any help!
P.S. I'm using Postman for testing, so if there is a way to set it there it could also work...
You need to pass the JVM parameter: "-Duser.timezone=GMT" when starting your app.
If you start your app with sbt run, try:
env JAVA_OPTS="-Duser.timezone=GMT" sbt run
then the output for println(DateTime.now().toString)
is: 2018-10-10T18:20:45.386Z

How do I setup the Date URLs Plugin for DocPad?

I've recently converted from Octopress to Docpad and couldn't be happier. I like everything, but one thing bothers me. At the moment all paths on my site are built directly from the filename, e.g. www.site.com/posts/yyyy-mm-dd-title/. What I want to get is www.site.com/posts/yyyy/title. I found the Date URLs plugin, but cannot understand how to set it up. I tried inserting the relevant part into docpad.coffee as follows:
docpadConfig =
plugins:
dateurls:
cleanurl: true
trailingSlashes: true
collectionName: 'posts'
dateFormat: '/YYYY'
templateData:
site:
But nothing seems to change. The collection is defined as follows:
posts: ->
#getCollection("html").findAllLive({relativeOutDirPath:'blog'},[date:-1]).on "add", (model) ->
model.setMetaDefaults({layout:"post"})
--
EDIT (in response to Lukasz Gornicki)
A sample of metadata from the blog folder:
---
title: "Les Sapeurs"
date: 2014-09-25 07:39
comments: false
language: english
tags: video
keywords: anton zujev, antzoo, zujev, sapeurs, style, congo
description: Les Sapeurs are fashionistas from Congo, whose style is a political and social outcry.
---
A sample of metadata from the cast folder:
---
title: "Utan 7"
date: 2015-02-27 06:52
podfeed: utan
comments: true
---
I didn't try the debug mode before. Now I did, but I don't see anything special in the log. Here's the log file.
I've installed the plugin on my blog to check it out. I think there is a bug in documentation or it is just supper misleading. Documentation doesn't explicitly say that the url is build against the date metadata with dateFormat configuration and file basename without the date. I copied your configuration use it agains my blog with post 2015-02-16-test-test.html.md with metadata: date: 2014-09-25 9:49.
result url: http://localhost:9778/2014/test-test/
So the plugin works. Do you think that docpad doesn't pick up any configuration for the plugin? If you are configuring docpad with docpad.coffee I suggest you to validate the file, if it is created according to coffeescript rules and you have right indentation. Some time ago I had a situation that my config file grew a lot and some of the config was not picked up because of indentation.
Or just give access to the project so I can see and tell you what is wrong.
MORE DETAILS TO THE ANSWER AFTER CHECKING THE PROJECT:
Filename can have a date. The plugin uses regex to take just the string out of the filename - basename.
Locally I've commented out your hook into the renderBefore event, installed the plugin, added your config and all works as expected if it comes to the urls. So I get a URL like /2014/movie-quotes/
On the other hand it works when the server is started, but when I look on the out dir and try to generate the static content, it looks like the plugin doesn't work. Is this what you mean when saying that plugin doesn't work?

Access current git commit number from within Heroku app

I know the slug compiler removes the .git directory when creating a heroku slug, but is there any way to configure Heroku so that I can access the currently running git commit number from within my scripts?
I'd like to be able to have a small link on my sinatra app (run within Heroku) which says "running version e72fb274a0" (or something similar). How can I retrieve this, or force the slug compiler to add it to an environment variable?
PROGRESS:
I reckon the best way to do this is to make a custom buildpack which writes the git commit version number to the heroku slug before the .git directory is deleted.
I've tried to do this (see my fork of the ruby buildpack) but the line I've added – line 23 – doesn't seem to be doing the job. Heroku sees & uses the new buildpack, but doesn't seem to write the file to the slug.
Anyone have any idea why my custom buildpack isn't working as expected?
Thanks,
JP
A couple of options...
SOURCE_VERSION environment variable (build-time)
Since 1st April 2015, there's a SOURCE_VERSION environment variable available to builds running on Heroku. For git-pushed builds, this is the git commit SHA-1 of the source being built:
https://devcenter.heroku.com/changelog-items/630
(thanks to #srtech for pointing that out!)
An example of me using that variable in a build - if you look at the HTML served by the deployed app, you'll see the commit id is coming though in an HTML comment near the very bottom: https://gu-who.herokuapp.com/
/etc/heroku/dyno metadata file (run-time)
Heroku have beta functionality to write out a /etc/heroku/dyno metadata file onto your running dyno. If you email support you can probably get added to the beta. Here's a place where Heroku themselves are using it:
https://github.com/heroku/fix/blob/6c8ab7a/lib/heroku_dyno_metadata.rb
The contents look like this:
{
"dyno":{
"physical_id":"161bfad9-9e83-40b7-b385-78305db2f168",
"size":1,
"name":"run.7145"
},
"app":{
"id":null
},
"release":{
"id":50,
"commit":"2c3a0b24069af49b3de35b8e8c26765c1dba9ff0",
"description":null
}
}
..so release.commit is the field you're after. I used to use this method until the SOURCE_VERSION variable became available.
In 2018 this is what you want:
https://devcenter.heroku.com/articles/dyno-metadata
heroku labs:enable runtime-dyno-metadata -a <app name>
You can run a script before deploy that store this information (maybe on a YAML)
using these a = `ls` (note that is not ' "apostrophe" sign is ` "inverse accute" sign)
the a variable will have the result of this bash command,so you can do
git = `git log`
and then find the information you want it and store it.
So you will be able to retrieve it later.
Did this helped ?

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.

How do I put current date time (and other non-predefined) variables in info.plist of a Xcode project?

I am trying to put current date & time in the info string of my Xcode project's info.plist. There's no predefined variable for this as far as I can see. The best I can think of is to add this to my Run Script:
export MYDATETIME=`date`
And use this as info.plist's Get Info string"
1.0 ${MYDATETIME} Copyright 2011 by Me
That doesn't work since any variables set during Run Script phase don't survive the past the phase. Any way I can make the variable persistent thru the build process?
BTW. The goal is to have the date time stamp as part of the version string.

Resources