HTMLBars how to get started? - ember.js

Is there any guide how to start with HTMLBars? I am following "building HTMLBars" section but finally I am stuck. I have run building tool and now I have files in my dist directory like this:
.
├── htmlbars-compiler.amd.js
├── htmlbars-runtime.amd.js
├── morph.amd.js
├── test
│   ├── htmlbars-compiler-tests.amd.js
│   ├── htmlbars-runtime-tests.amd.js
│   ├── index.html
│   ├── loader.js
│   ├── morph-tests.amd.js
│   ├── packages-config.js
│   ├── qunit.css
│   └── qunit.js
└── vendor
├── handlebars.amd.js
└── simple-html-tokenizer.amd.js
Which should I add to my ember project and is that all or have I to do something more? Is this library ready or it is still unusable for ember?

Not even close to ready yet, I'd love to give more info, but there really isn't any. Last I heard they wanted it as a beta in 1.9, but we'll see.

Related

Running all tests for a multi-binary project

Consider a multi binary project with the following structure.
.
├── bin1
│   ├── config
│   │   ├── config.go
│   │   └── config_test.go
│   └── utils
│   ├── utils.go
│   └── utils_test.go
├── bin2
│   ├── config
│   │   ├── config.go
│   │   └── config_test.go
│   └── utils
│   ├── utils.go
│   └── utils_test.go
├── cmd
│   ├── bin1
│   │   └── bin1.go
│   ├── bin2
│   │   └── bin2.go
│   └── bin3
│   └── bin3.go
├── go.mod
├── go.sum
└── shared
├── db
│   ├── db.go
│   └── db_test.go
├── model
│   ├── modela.go
│   ├── modela_test.go
│   ├── modelb.go
│   └── modelb_test.go
└── utils
├── utils.go
└── utils_test.go
This project has three binaries bin1, bin2 and bin3. Packages in the /shared directory (e.g. package shareddb, sharedmodel and sharedutils) are shared with binary specific packages (e.g. package bin1config, bin1utils in /bin1 directory and package bin2config, bin2utils in /bin2 directory).
How can we run
all the unit tests in this project altogether?
all the tests in a package (e.g. in shared/model)?
each tests separately?
I attempted the following.
Running go test from the project root resulted in no Go files in /projectroot.
# run all tests
go test ./...
# run all tests under a specific directory (including subdiretories)
go test ./bin2/...
# test package located in specific directory
go test ./shared/model
# test package that has specific import path
go test projectroot/shared/model
# test package in current working directory
go test
# ditto
go test .
# test package in parent directory
go test ..
# run a specific test within the package under test
go test -run=X
# run a specific sub-test within the package under test
go test -run=X/Y
For more details on the go test command, see Test packages.
For more details on the [packages] argument to go test, see Packge lists and patters.
For more details on the testing flags, see Testing flags.

Calling the header file in the parent folder

I'm doing some experiments to learn CMake. So the commands stay in my mind. I created a project to test what I just learned. However, I have a problem.
The structure of my project is as follows:
├── bin
├── CMakeLists.txt
└── src
├── Configuration
│   ├── CMakeLists.txt
│   ├── Test
│   │   └── TestConfiguration.h
├── Array
│   └── Array.h
├── CMakeLists.txt
├── Test2
│   ├── CMakeLists.txt
│   ├── Test2.cpp
│   ├── Test2.h
│   └── Test2-1.h
├── Main
│   ├── CMakeLists.txt
│   ├── Config.h
│   └── Main.h
├── Test3
│   ├── CMakeLists.txt
│   ├── Time.h
│   ├── Timer 
│   │   ├── CMakeLists.txt
│   │   ├── Iterate.h
│   │   ├── Run.h
│   │   ├── Serial.cmpl.cpp
│   │   └── Serial.h
│   ├── Smart.h
│   ├── Counting.h
│   ├── Mute.h
│   └── MainTest.h
└── Utilities
├── CMakeLists.txt
├── Inform.h
├── Settings.h
├── Print.h
└── Const.h
But I didn't understand how I should make these CMakeLists.txt files. For example, the file src/Utilities/Inform.h uses the following header:
// src/Utilities/Inform.h
#include "Main/Config.h"
I've tried everything I've seen on the internet and stackoverflow to edit the src/Utilities/CMakeLists.txt file. But no matter what I do, it never sees the Main/Config.h file. I just need to do something like ../../Main/Config.h.
The same problem applies to other folders. What I want to learn here is to be able to navigate and call all files in the project with CMakeLists.txt. While doing this, I tried many of the following parameters:
add_library
target_include_directories
target_link_libraries
link_directories
link_libraries
I think there's something I'm missing or misunderstood. I would be glad if you help me in this regard. If you tell me how to edit the src/Utilities/CMakeLists.txt file, I will try to fill the others accordingly.
Additionally, there is something I'm curious about. Do I also need to edit the src/CMakeLists.txt file? Or is it enough if I just edit for example src/Utilities/CMakeLists.txt?
Also, I don't know if it will be needed additionally, but I'm using cmake version 3.16.3. My development environment is an x86_64 20.04.1 Ubuntu-based Elementary OS.
I've read the official documentation for CMake 3.16 and the answers from fellow developers on StackOverFlow. I want to use the header file in the parent folder in a header in subdirectories. But many ways I've tried are wrong. There is always an error in the include path I entered. I want to learn from experienced developers what I did wrong.

Django best practice for scripts organizing

I had the project on Django 3.1 with the following layout:
.
├── app
│   ├── app
│   │   ├── asgi.py
│   │   ├── __init__.py
│   │   ├── settings.py
│   │   ├── urls.py
│   │   └── wsgi.py
│   ├── core
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── fixtures
│   │   │   ├── Client.json
│   │   │   └── DataFeed.json
│   │   ├── __init__.py
│   │   ├── migrations
│   │   │   ├── 0001_initial.py
│   │   │   ├── 0002_auto_20201009_0950.py
│   │   │   └── __init__.py
│   │   ├── models.py
│   │   └── tests
│   │   └── __init__.py
│   └── manage.py
I want to add 2 scripts to this project:
download_xml.py - to check and download .xml files from external sources by schedule (every ~30 min)
update_db_info.py - to be invoked by download_xml.py and transfer data from downloaded xml to the database
What is the best django practice for organizing a placement for this kind of scripts?
My ideas:
just create scripts folder inside of an app/core and put scripts there. Invoke them using cron
run python manage.py startapp db_update
so the new app in django will be created. I will remove migrations, views, models etc from it and put scripts there. use cron again
Create app/core/management/commands folder and put scripts there. Call them by cron using python manage.py download_xml && python manage.py download_xml update_db_info
Option 3 (mostly)
However if download_xml.py doesn't use or rely on Django, I would put it in a scripts directory outside of the Django project (but still in source control). You might decide not to do this if the script does need to be deployed with your app. It doesn't need to be a management command though.
update_db_info.py definitely sounds like it would be best suited as a management command.

Virtualenv for a project with multiple modules

I am trying to build a project from scratch in python 2, it has structure shown below. In past I have created projects with a single hierarchy, so there would be single virtualenv, but this project has multiple subpackages, what is the best practice to be followed: there should be a single virtualenv inside project_root directory shared by all subpackages in it, or there should be separate virtualenv for each subpackage?
project_root/
├── commons
│   ├── hql_helper.py
│   ├── hql_helper.pyc
│   ├── __init__.py
│   └── sample_HQL.hql
├── fl_wtchr
│   ├── fl_wtchr_test.py
│   ├── fl_wtchr_test.pyc
│   ├── __init__.py
│   ├── meta_table.hql
│   ├── requirements.txt
│   ├── sftp_tmp
│   ├── sql_test.py
│   └── sql_test.pyc
├── qry_exec
│   ├── act_qry_exec_script.py
│   ├── hive_db.logs
│   ├── params.py
│   └── params.pyc
├── sqoop_a
│   ├── __init__.py
│   └── sqoop.py
└── test.py
A case could be made for creating separate virtual environments for each module; but fundamentally, you want and expect all this code to eventually be able to run without a virtualenv at all. All your modules should be able to run with whatever you install into the top-level virtual environment and so that's what you should primarily be testing against.

apache2: /etc/apache2/sites-available is missing on macos

I am trying to configure apache2 so that it communicates with django and I am unable to the 'sites-available' directory where I believe a 'defaults' directory should reside.
The following is my file structure under the 'etc/apache2/' directory:
├── extra
│   ├── httpd-autoindex.conf
│   ├── httpd-dav.conf
│   ├── httpd-default.conf
│   ├── httpd-info.conf
│   ├── httpd-languages.conf
│   ├── httpd-manual.conf
│   ├── httpd-mpm.conf
│   ├── httpd-multilang-errordoc.conf
│   ├── httpd-ssl.conf
│   ├── httpd-userdir.conf
│   ├── httpd-vhosts.conf
│   └── proxy-html.conf
├── httpd.conf
├── httpd.conf.bak
├── httpd.conf.pre-update
├── magic
├── mime.types
├── original
│   ├── extra
│   │   ├── httpd-autoindex.conf
│   │   ├── httpd-dav.conf
│   │   ├── httpd-default.conf
│   │   ├── httpd-info.conf
│   │   ├── httpd-languages.conf
│   │   ├── httpd-manual.conf
│   │   ├── httpd-mpm.conf
│   │   ├── httpd-multilang-errordoc.conf
│   │   ├── httpd-ssl.conf
│   │   ├── httpd-userdir.conf
│   │   ├── httpd-vhosts.conf
│   │   └── proxy-html.conf
│   └── httpd.conf
├── other
│   └── php5.conf
└── users
├── Guest.conf
├── aphexlog.conf
└── secops.conf
If anyone knows if there is a possibility of a alternative config file with the same properties or some other solution... maybe I am just being dumb but everything that I have found online indicates that I should have this properties file.
Any and all help is appreciated :)
sites-available is a concept from Debian-derived distributions of Linux. MacOS does not have it, and neither do most other Linux flavours.
Instead you need to put your configuration directly in httpd.conf.
(Note, it's unusual to run a production system on a Mac; if you're just doing this for development, you can use the built-in runserver rather than messing around with Apache.)