How to harmonize github pages for project with http-server? - github-pages

Github pages (https://docs.github.com/en/pages) is an amazing tool for documenting your git hub project.
However, I am having a little trouble trying to use http-server (https://www.npmjs.com/package/http-server) to preview/debug my pages.
I'm trying to use the myproject/docs folder as my Github docs web page. My file structure looks something like "myproject/docs/pages/sometopic/somepage.html".
I can reference other pages in the project with something like "/myproject/pages/sometopic/somepage.html"
Note the leading "/" and the absence of the "docs" folder in the path.
If I try to use something like html-server to preview/debug my pages all of the links are broken as html-server does not strip out the "/docs" part of the url.
Is there a way I can configure either html-server and/or Github pages so that they use the same references?
I've tried using relative references (e.g. pages/sometopic/somepage.html and ../../../index.html but either Github pages and/or the frameworks I'm using do not consistently recognize them).
EDIT:
I can't use relative links because that seems to break jquery (version 1.11.3).

This was quite easily done by adding a logical link and then launching the http-server from the appropriate location relative to the logical link.
Link was created like this:
mklink /D fhir-to-omop ..\..\docs

Related

How publish a directory with ring middleware?

I am trying to use Clojure + Compojure + Ring in combination with the qooxdoo JS library. This is actually going well, but qooxdoo runs in two modes "build" (that works for me) and "source" (not so good). In the latter case, the JS generated by qooxdoo actually hardcodes references (well, using relative addresses ../../..) back to the qooxdoo installation and at run time it asks for sth like:
http://localhost:3000/opt/qooxdoo-5.0.1-sdk/framework/source/class/qx/bom/client/OperatingSystem.js
...since I have the library installed under /opt/qooxdoo-5.0.1-sdk.
Serious sanity check: if I directly open the index.html in the browser, it works fine. So it seems I just have to figure out how to serve the static files under the /opt library install.
I have tried wrap-file from the ring.middleware.file because that sounds like what I want but no matter what path I give it I get hundreds of 404s as it tries to pick up each framework file individually from the installed library.
I can work OK under "build" (qooxdoo cobbles together a single minified .js I serve with wrap-resource) but on occasion I need to run in source mode to find JS bugs.
Am I missing something simple?
The correct way to handle this is to configure Qooxdoo to tell it what URIs you would like to use - by default the source build does just use relative paths, but you can easily override this by editing the config.json.
In your config.json you will have a "jobs" section containing a "libraries" section, containing a "library" array - your application is a library, as is Qooxdoo, as is any contribs so it will look something like this:
"jobs" : {
"libraries" : {
"=library" : [ {
"manifest" : "${QOOXDOO_PATH}/framework/Manifest.json"
}, {
"manifest" : "Manifest.json"
}
},
Each "library" object can have a "uri" property, so for your example you probably want something like this:
"jobs" : {
"libraries" : {
"=library" : [ {
"manifest" : "${QOOXDOO_PATH}/framework/Manifest.json",
"uri" : "/opt/qooxdoo-5.0.1-sdk"
}, {
"manifest" : "Manifest.json"
}
},
Simple indeed: (wrap-file "/")
In development/source mode qooxdoo works off the installation directory instead of code pulled into my local tree, and does so by hardcoding relative paths that resolve to an absolute /opt/qooxdoo-etc path.
This looks to the server like a relative "opt/qooxdoo..." file request, so I had to offer root ("/") as a search directory.
(wrap-file "/") is a serious security issue since you're offering the root directory for all.
What you can potentially do is to make a dedicate directory to server your static file, and serve your content from there.
su
mkdir -p /var/clojure/static/opt
cd /var/clojure/static/opt
ln -s /opt/qooxdoo-5.0.1-sdk qooxdoo-5.0.1-sdk
chown -r YOUR-USER-ID /var/clojure/static/opt
And use the middleware: (wrap-file "/var/clojure/static") to serve your file.
There is a section in the manual that deals with the issue of serving a source version through a web server.
I guess you found the basic insight yourself, that the web server must export a root where the relative paths used in the generated loader match URL paths under that web server. (The rational behind this is that the source version uses all the JS files from all involved libraries directly from disk.)
In the worst case that might mean you need to export the file system root ("/") from your web server. As you are doing this on a local development machine this shouldn't be much of a problem. If security is a concern you might want to collect your qooxdoo environment under some innocent path like /home/kenny/devel/qooxdoo, containing the qooxdoo SDK, your app, and all libs/contribs you might be using.
If you follow the above link you will also find some help from the qooxdoo tool chain. E.g. if you run generate.py source-httpd-config[*] it will tell you which path on your local disk is the closest parent directory that will encompass all necessary libraries, i.e. needs to be exported in your web server for the source version to work.
Alternatively, as John wrote you can export each qooxdoo lib through an individual path under your web server, and then tell your main application where to find it. You might actually need to give a proper URL like http://localhost/libs/qooxdoo-5.0.1-sdk/framework, not just a file system path as John suggests. Also remember that you have to go as far as the directory where the Manifest file resides (hence the above path ending in .../framework). See this manual section for a deep dive.

Using Sphinx-apidoc to generate documentation from C++ code

There have been a couple of threads on this topic in the past that claim Sphinx doesn't support this at all. I had my doubts but either it has been updated since or the documentation for it was quite well hidden, because here is a link on the website stating otherwise:
http://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cpp-domain
Anyway, I'm new to Sphinx but am trying to use it to (eventually) automate documentation using some text from some source C++ code. So far I haven't been able to get anywhere when using the sphinx-apidoc -o ... command. An almost blank document is created. I'm probably not using the right directives, since I don't know how - the supporting documentation hasn't been able to help me.
Can anyone provide some assistance with the basic steps needed to get it working? If it is not possible to auto-generate documentation from C++, what are the C++ domains for and how to use them?
On auto-generating C++ documentation:
After reading up on how to use sphinx at all, you should have a look into breathe:
Breathe provides a bridge between the Sphinx and Doxygen documentation
systems.
It is an easy way to include Doxygen information in a set of
documentation generated by Sphinx. The aim is to produce an autodoc
like support for people who enjoy using Sphinx but work with languages
other than Python. The system relies on the Doxygen’s xml output.
So additionally, you'll need to follow Doxygen commenting style and even setup an doxygen project. But I tried that and it works really well after the initial setup took place. Here is an excerpt of our CMakeLists.txt which might give you an idea on how sphinx and doxygen work together:
macro(add_sphinx_target TARGET_NAME BUILDER COMMENT_STR)
add_custom_target(${TARGET_NAME}
COMMAND sphinx-build -b ${BUILDER} . sphinx/build/${BUILDER}
WORKING_DIRECTORY docs
DEPENDS doxygen
COMMENT ${COMMENT_STR}
)
endmacro(add_sphinx_target)
add_custom_target(doxygen
COMMAND doxygen docs/doxygen.conf
COMMENT "Build doxygen xml files used by sphinx/breathe."
)
add_sphinx_target(docs-html
html
"Build html documentation"
)
So after initial setup, essentially it boils down to:
build doxygen documentation with doxygen path/to/config
cd into the directory where the sphinx configuration is.
build sphinx documentation with sphinx-build . path/to/output
On the c++ domain:
Sphinx is a „little bit“ more than a system to auto-generate documentation. I would suggest you have a look at the examples (and consider that the sphinx website itself is written in sphinx reST code). Especially click the Show Source link on many sphinx-generated pages.
So if you cannot generate documentation automatically for a project, you have to do it yourself. Basically sphinx is a reST to whatever (LaTeX, HTML, …) compiler. So you can write arbitrary text, but the advantage is that it has a lot of commands for documenting source code of different languages. Each language gets its own domain (prefix or namespace) to separate the namespaces of the different languages. So for example I can document a python function using:
.. py:function:: Timer.repeat([repeat=3[, number=1000000]])
Does something nasty with timers in repetition
(source)
I can do the same using the cpp domain:
.. cpp:function:: bool namespaced::theclass::method(int arg1, std::string arg2)
Describes a method with parameters and types.
(source)
So if you want to document your c++ project without doxygen+breathe but with sphinx, you'll have to write the restructured text files yourself. This also means that you split the documentation from your source code, which can be undesirable.
I hope that clears things up a bit. For further reading I strongly suggest that you have a good read on the sphinx tutorial and documentation until you understood what it actually does.

Really confused about installing PHP Modules

I need to add http://us3.php.net/xsl this module to my PHP but I'm really confused how I actually do this? It says in install from that link 'PHP 5 includes the XSL extension by default and can be enabled by adding the argument --with-xsl[=DIR] to your configure line. DIR is the libxslt installation directory.' But unsure where these files would be? I have a VPS and access to WHM Cpanel, can I do this from there? I came across the software and install module bit in WHM but get the feeling that's not what I want...
Go to WHM -> Software -> EasyApache (Apache Update)
On the EasyApache page, choose Start customizing based on profile now, and after a couple screens, choose Exhaustive Options List. Select the modules you want to install, XSL in your case, and proceed to recompile.
You need to compile PHP manually, if you want any modules that you don't currently have. There are plenty of tutorials how to do it, for example if you have Apache 2 as a webserver, then follow this page on php.net: http://www.php.net/manual/en/install.unix.apache2.php
When you compile PHP, one of the commands to do is
./configure
in which you can (and most webhostings do) supply many many arguments, which say which modules you want to have installed and what features PHP can use. It may look like this:
./configure '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/php/lib' '--with-apxs' '--with-iconv=/usr/local/php' '--with-openssl=/usr' '--with-zlib=/usr' '--with-mysql' '--with-pgsql=/Users/marc/cvs/entropy-php4/php-module/build/postgresql-build' '--enable-cgi' '--with-gd' '--with-png-dir=/usr/local/php' '--with-freetype-dir=/usr/local/php' '--with-t1lib=/usr/local/php' '--with-jpeg-dir=/usr/local/php' '--with-tiff-dir=/usr/local/php' '--with-curl=/usr/local/php' '--with-mcal=/usr/local/php' '--with-mcrypt=/usr/local/php' '--with-mhash=/usr/local/php' '--with-pdflib=/usr/local/php' '--with-imap=../imap-2002d' '--with-imap-ssl=/usr' '--with-expat-dir=/usr/local/php' '--with-gettext=/usr/local/php' '--with-dom=/usr/local/php' '--with-dom-xslt=/usr/local/php' '--with-dom-exslt=/usr/local/php' '--with-xslt-sablot=/usr/local/php' '--with-mime-magic=/usr/local/php/etc/magic.mime' '--with-mssql=/usr/local/php' '--with-fbsql=/Users/marc/cvs/entropy-php4/php-module/build/frontbase-build/Library/FrontBase' '--with-ming=/Users/marc/cvs/entropy-php4/php-module/build/ming-build' '--enable-xslt' '--with-ldap' '--with-xml' '--with-xmlrpc' '--with-iodbc=/usr' '--enable-sockets' '--enable-dbx' '--enable-dbase' '--enable-trans-sid' '--enable-exif' '--enable-wddx' '--enable-ftp' '--enable-mbstring'
it this example there are a lot of enabled modules. You can also see what "configure line" was used to compile your current version of PHP in phpinfo (it's right at the top, third line).

The Xcode4.2 with ASIHTTPRequest configuration

I installed ASIHTTPRequest follow the document on their official site . But still have errors here. Please help. The related info is as follows :
Xcode 4.2 build 4D58
Lion 10.7.2
I can not upload the images because I am rookie here.(now I upload to site and linked here)
http://roundmov.com/project.png
build settings and build phrase png is here :
http://www.roundmov.com/buildphases.png
I have added all the files including external dir. and added libraries ,all of them in docs mentioned.
Even added the header search paths as $[SDKROOT]/usr/include/libxml2
But still have 107 or 67 errors . This problem has boring me one more day.
Thanks a lot in advance!
How can I disable ARC for a single file in a project?
If you follow the instructions here for all of the ASIHTTPRequest files it will compile as you need to disable arc on those files.
ah right, yep, so ASIHTTPRequest isn't ARC compatible and it doesn't look like that will change. i've never actually "downgraded" a project from ARC to non-ARC, but if it's something you've just started on you could create a new project and uncheck the ARC checkbox when you do and re-add all your existing files. this will mean you need to handle the memory management of objects (retain/release/autorelease).
this thread has more info:
https://groups.google.com/group/asihttprequest/browse_thread/thread/3f26e442dc6868e8
as an alternative, you could look into AFNetworking:
https://github.com/AFNetworking/AFNetworking
you still need to take some extra steps to get it working with ARC, but it doesn't look too bad.

Can I create a cross-project source reference in redmine?

If you have two separate projects that is somehow connected. How can one make a reference to the source of the other project?
For referencing the source of your own project you use:
source:some/file
But since I want to refer to code in another project my thought was that I could write something like:
other_project:source:some/file
Anyone that knows if this is possible in some way? I have read http://www.redmine.org/wiki/redmine/RedmineTextFormatting#Redmine-links but found no clues there.
Apparently this was implemented in Redmine 1.2.0 (released 2011-05-30). The syntax is exactly the one you suggested in the question, other_project:source:some/file, other_project being the project identifier.
It is possible in a couple of ways - although neither solution is particularly neat.
use an external html link to the other_project source code, where other-proj is the identifier for the other project.
"other project source":http://myserver:3000/projects/other-proj/repository/entry/file.txt
define the source path via the parent directories, so from the source directory of your current project go up 3 directory levels before navigating back down to the repository of your other project. Note the source link needs to be inside double quotes to work. This method at least keeps the source tag at the front of the link.
source:"../../../other-proj/repository/entry/file.txt"
The Redmine Text Formatting page says the format is:
source:repo_identifier|some/file
Even so, the selected answer works for my version of Redmine (1.4.2), but it may have been changed in later versions. This link format was added to that wiki page on 2012-08-27, after OP asked their question.