Does anyone know how to split the list of projects on the 'Available Projects' page into a list of active and archived projects? At the moment they are all listed together and I have a large number of projects so it is difficult to identify just the active projects.
I'm not a web developer or python expert so I would appreciate simple, easy-to-follow answers.
Thanks in advance.
The project index can be customized. You'll need a criteria for grouping the projects into active and archived. Here you can see the variables that are listed for each project. You could add a value in the config/trac.ini file for each project, such as [project] archived = true, and read that value when rendering the project index in order to determine which group to list the project in - active vs. archived. The value can be read using env.config.get('project', 'archived').
Here is a proof-of-concept.
Create 4 projects and set 2 of them as archived:
$ mkdir projects && cd projects
$ virtualenv pve
$ source pve/bin/activate
$ pip install trac
$ mkdir environments && cd environments
$ for i in `seq 1 4`; do
trac-admin env$i initenv "Project $i" sqlite:db/trac.db
done
$ trac-admin env3 config set project archived true
$ trac-admin env4 config set project archived true
Add the following in projects/index.html:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<head>
<title>Available Projects</title>
</head>
<body>
<h1>Active Projects</h1>
<ul>
<li py:for="project in projects"
py:if="not project.env.config.get('project', 'archived')"
py:choose="">
<a py:when="project.href" href="$project.href"
title="$project.description">$project.name</a>
<py:otherwise>
<small>$project.name: <em>Error</em> <br /> ($project.description)</small>
</py:otherwise>
</li>
</ul>
<h1>Archived Projects</h1>
<ul>
<li py:for="project in projects"
py:if="project.env.config.get('project', 'archived')"
py:choose="">
<a py:when="project.href" href="$project.href"
title="$project.description">$project.name</a>
<py:otherwise>
<small>$project.name: <em>Error</em> <br /> ($project.description)</small>
</py:otherwise>
</li>
</ul>
</body>
</html>
Run TracStandalone:
$ cd projects
$ TRAC_ENV_INDEX_TEMPLATE=`pwd`/index.html tracd -r -p 8001 --env-parent-dir=environments
The result is:
Related
I am complete beginner so I apologize in advance.
I have installed npm with these scripts in terminal
1.curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
2.nvm install node
then I set it to run like this
http-server -a localhost
Starting up http-server, serving ./public
Available on:
http://localhost:8081
an I have an index. html in my documents that I would like to display. I have tried to just state the whole path in the browser so like http://localhost:8081/Documents/testServer/index.html
But that doesn't work
You must install the tools inside the folder that contains index.html file as below
First : Open the folder that contain index.html
Second : Install Tools
1.curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
2.nvm install node
Third : Open the live server at :
http://localhost:8081/Documents/testServer/index.html
I'm trying to enable export html to pdf in my language (Hebrew).
The html and export work fine on my local machine (Mac).
I'm using https://github.com/wkhtmltopdf/
On the remote machine(Centos7)
The html works with the Hebrew fonts but the export to pdf outputs this
I've tried following:
1.
<head>
<meta name="pdfkit-page-size" content="Legal"/>
<link rel="stylesheet" href="/static/webapp/plugins/manual/pdf.css">
<meta charset="UTF-8">
</head>
sudo yum install curl cabextract xorg-x11-font-utils fontconfig
sudo yum install liberation-sans-fonts
sudo yum install dejavu-lgc-sans-fonts (from: https://gist.github.com/drakakisgeo/7591660)
None worked.
The output of locale
[my_user#ip-172-31-34-70 ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
Any suggestions?
The answer is that the remote server didn't have the right fonts.
I have also solved this by just copying Arial.ttf from my local mac in /Library/Fonts
scp -i "$STAGING_CERT_PATH" Arial.ttf root#"$STAGING_IP":/usr/share/fonts/local/
to my remote server to /usr/share/fonts/local (created the local dir myself).
then fc-cache -v to update and it worked
try this one yum install cjkuni-uming-fonts
Given two scripts
foo.sh
bar.sh
copied under /Contents/Resources in an .app bundle, where foo.sh
#!/bin/bash
. ./bar.sh
echo $1
Do get an error of
No such file or directory
on the line where the script tries to source bar.sh
Is there a way to relatively reference bar.sh?
Is there another way to bundle a set of bash scripts in a .app?
What you can do is:
get the full path & directory where the actual running script (your foo.sh) is stored. see https://stackoverflow.com/a/246128/3701456
call or source the second script (your bar.sh) with directory from 1. (or relative to that directory)
Simple Example:
$cat script2
#! /usr/bin/env bash
echo "Hello World, this is script2"
$cat script1
#! /usr/bin/env bash
echo "Hello World from script 1"
echo "Full script path: $BASH_SOURCE"
echo "extracted directory: $(dirname $BASH_SOURCE)"
echo "running script 2"
$(dirname $BASH_SOURCE)/script2 && echo "running script 2 successful" || echo "error running script 2"
echo "sourcing script 2"
source $(dirname $BASH_SOURCE)/script2 && echo "sourcing script 2 successful" || echo "error sourcing script 2"
Test:
$ls /tmp/test
script1 script2
$pwd
/home/michael
$/tmp/test/script1
Hello World from script 1
Full script path: /tmp/test/script1
extracted directory: /tmp/test
running script 2
Hello World, this is script2
running script 2 successful
sourcing script 2
Hello World, this is script2
sourcing script 2 successful
See link above for more in detail discussion ...
Old question but to address the last part (reflecting the current Apple guidelines): yes, you should definitely place all executables (including scripts) in the MacOS sub-folder of your bundle:
MacOS - (Required) Contains the application’s standalone executable code. Typically, this directory contains only one binary file with your application’s main entry point and statically linked code. However, you may put other standalone executables (such as command-line tools) in this directory as well.
(Source: Anatomy of a macOS Application Bundle.)
Breaking these rules will prevent you from successfully signing your app bundle for Gatekeer (and, of course, macOS Notarization).
The first part was adequately handled by the other response.
I thought this should be easy, and maybe it is, and it's just me.
I want to test downloading files from my folder but getting empty html results:
$ curl -L https://api.box.com/2.0/files/f_XXXXXXXX/content \ -H "Authorization: Bearer 8wAsXXXXXXXXX"
<HEAD><TITLE>gw</TITLE>
</HEAD>
<BODY>
GW
</body>
</html>
<HEAD><TITLE>gw</TITLE>
</HEAD>
<BODY>
GW
</body>
</html>
Any idea what I may be doing wrong?
This should work:
curl -L https://api.box.com/2.0/files/FILE_ID/content \
-H "Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN"
It's working properly for me. Command execution might be affected by local configuration file ~/.curlrc. Have you got this file? What is its content?
i have a bash script that copies and modifies a bunch of configuration files in my app running as a cgi for fast deployment and testing.
This script is in the public_html folder of my hosting and it works perfectly, permissions set to 755.
I am making other cgi scripts in a subfolder public_html/foo/bar.cgi and giving it 755 permission.
#!/bin/bash
echo "Content-type: text/html"
echo ""
# test if we are in the correct place
touch foo 2>&1
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '</head>'
echo '<body>'
echo '<p>Hello World</p>'
echo '<p> </p>'
echo '<hr/>'
echo '</body>'
echo '</html>'
exit 0
This doesn't work, the server answers with a 403.
I have checked the folder permission, and set it to 755 and 777 without results
UPDATE: Changed name from test.cgi to testscript.cgi and it's woking now