Popular New Releases in Version Control System
husky
git-lfs
v3.1.2
FastGithub
2.1.4
git-imerge
Release 1.2.0
CSS-Exchange
v22.04.22.1452
Popular Libraries in Version Control System
by typicode javascript
26085 MIT
Git hooks made easy 🐶 woof!
by git-lfs go
10200 NOASSERTION
Git extension for versioning large files
by src-d go
4985 Apache-2.0
Project has been moved to: https://github.com/go-git/go-git
by dotnetcore csharp
4692 MIT
github加速神器,解决github打不开、用户头像无法加载、releases无法上传下载、git-clone、git-pull、git-push失败等问题
by mhagger python
2220 GPL-2.0
Incremental merge for git
by jakubgarfield csharp
1661 NOASSERTION
Bonobo Git Server for Windows is a web application you can install on your IIS and easily manage and connect to your git repositories. Go to homepage for release and more info.
by golbin javascript
1068 MIT
A git tool with an easy terminal interface.
by ghooks-org javascript
1047 MIT
Simple git hooks
by microsoft powershell
1005 MIT
Exchange Server support tools and scripts
Trending New libraries in Version Control System
by dotnetcore csharp
4692 MIT
github加速神器,解决github打不开、用户头像无法加载、releases无法上传下载、git-clone、git-pull、git-push失败等问题
by microsoft powershell
1005 MIT
Exchange Server support tools and scripts
by toplenboren javascript
448 MIT
A simple git hooks manager for small projects
by php php
306 NOASSERTION
Tools for the PHP documentation
by pattern-f c
229 GPL-3.0
Hello from pattern-f.
by baidu ruby
111 MIT
MGit 是一款基于 Git 的多仓库管理工具,可以安全的、高效的管理多个 Git 仓库; 适合于在多个仓库中进行关联开发的项目,实现批量的版本管理功能,提高 Git 操作的效率,避免逐个执行 Git 命令带来的误操作风险。
by scm-manager java
77 MIT
The easiest way to share and manage your Git, Mercurial and Subversion repositories over http.
by typicode javascript
72 MIT
Quickly migrate your hooks from husky v4 to v6
by WithGJR go
67
A Tiny Git-compatible Git Implementation
Top Authors in Version Control System
1
5 Libraries
22
2
4 Libraries
26
3
3 Libraries
9
4
3 Libraries
26181
5
3 Libraries
180
6
3 Libraries
23
7
2 Libraries
6
8
2 Libraries
4
9
2 Libraries
167
10
2 Libraries
38
1
5 Libraries
22
2
4 Libraries
26
3
3 Libraries
9
4
3 Libraries
26181
5
3 Libraries
180
6
3 Libraries
23
7
2 Libraries
6
8
2 Libraries
4
9
2 Libraries
167
10
2 Libraries
38
Trending Kits in Version Control System
No Trending Kits are available at this moment for Version Control System
Trending Discussions on Version Control System
History of all git commands issued from repo's initialization
composer remove (uninstall) all installed packages (composer install rollback)
Get package source from sources.list.d
Unable to access the API key using BuildConfig
First time Git user, Push to remote repository takes forever
Should I be adding the Django migration files in the .dockerignore /.gitignore file?
How can I find all common sub strings using Rust , Python, javascript?
Error opening the database 'objectbox': In entity "Album", property "artistId": missing virtualTarget
Can't create a fresh Nuxt project?
Why does the Version Control System Git stage files first, instead of committing them directly?
QUESTION
History of all git commands issued from repo's initialization
Asked 2022-Mar-27 at 10:31I have the following use case:
On my local computer, I had the following structure of files/folders outside of any version control system, including git.
1ProjectFolder
2 ---Folder1
3 ----File1.txt
4 ----Folder2
5 ----File2.txt
6 ----100s of other files/folders
7
In preparation for version control, I first ran git init
in this folder.
This gave me:
1ProjectFolder
2 ---Folder1
3 ----File1.txt
4 ----Folder2
5 ----File2.txt
6 ----100s of other files/folders
7ProjectFolder
8 ---.git
9 ---Folder1
10 ----File1.txt
11 ----Folder2
12 ----File2.txt
13 ----100s of other files/folders
14
I then went to github and created a repository, say:
https://github.com/Tryer/ProjectFolder.git
After this, from the command line on my machine, I issued:
git remote add origin https://github.com/Tryer/ProjectFolder.git
I did not want to add Folder2
and its contents to the commit. I only wanted Folder1
and its contents to be committed.
I, by mistake, did not created a proper .gitignore
file leading to staging of some files from Folder2
when I then issued git add .
I do not now remember exactly whether I issued git rm -f <files from Folder2>
or git rm --cached <files from Folder2>
to unstage the unneeded files from Folder2
. The former would have forced deleted the files from Folder2
from both the staging area as well as my working tree (something I did not intend/want). The latter would have only unstaged the files but left them in my working tree (something that is precisely what I would have wanted.)
The number of files under Folder2
are rather large and a due diligence check on Folder2
's contents manually on my machine seems to reveal nothing amiss in terms of missing files from my working tree.
Yet, just to be absolutely sure, is there a way to list all of the git commands ever issued under a repository from the beginning of time? Note that I am not asking for a history of commands I have issued from the terminal command line. This would be available in a powershell history or bash shell history.
A previous question of exactly this issue is available here. However, the question is about 10 years old and the highest voted answer there suggests to use git reflog
. However, that seems to give history in terms of commits. I am looking more for the exact git commands that I have executed.
ANSWER
Answered 2022-Mar-27 at 10:31No, it's not possible with Git. Git does not keep track of the commands executed in a repository.
Your best bet is your shell's command history.
QUESTION
composer remove (uninstall) all installed packages (composer install rollback)
Asked 2022-Mar-16 at 15:36I have a project with the composer.lock
file.
I installed packages with the command:
1composer install
2
Now I would like to rollback that composer install
command to the state as it was before running it.
How to remove all packages without affecting composer.lock
file?
Is there any single composer
command to do that?
I tried:
1composer install
2composer remove *
3
but I got:
[UnexpectedValueException]
"LICENSE" is not a valid alias.
I tried:
1composer install
2composer remove *
3composer remove */*
4
But then I get bunch of print like:
bin/console is not required in your composer.json and has not been removed
Package "bin/console" listed for update is not locked.
Why composer remove *
did not work at all? AFAIK the package name as VendorName/PackageName
is a common convention for Packagist but not a must (if you use private repos) so how one would be able to remove all packages named IdontHaveAnySlash
etc. at once?
I may use someting similar to:
1composer install
2composer remove *
3composer remove */*
4for package in $(composer show | awk '{print $1}'); do composer remove --no-interaction --dev --no-install "$package"; done
5
But that is not a simple and single composer
command.
Also composer often complains about a package being a part (dependency) of another one so composer
does not uninstall it.
Removal failed, doctrine/annotations is still present, it may be required by another package. See
composer why doctrine/annotations
.
As my intention is to rollback to the state that did not have any package installed but only files: composer.lock
and potentially composer.json
I really don't care about any dependencies, packages versions, downloading repositories' urls etc.
I just want to have a project without any installed dependencies as it was before.
Is there any single composer
command to do that?
My:
1composer install
2composer remove *
3composer remove */*
4for package in $(composer show | awk '{print $1}'); do composer remove --no-interaction --dev --no-install "$package"; done
5composer --version
6
is:
version 2.2.7 2022-02-25 11:12:27
Following yivi answer I created a simple test to verify:
1composer install
2composer remove *
3composer remove */*
4for package in $(composer show | awk '{print $1}'); do composer remove --no-interaction --dev --no-install "$package"; done
5composer --version
6mkdir -p /tmp/composer-install
7cd /tmp/composer-install
8
9curl -o composer.json https://raw.githubusercontent.com/composer/composer/18246212db7103d0a2688febcc336f77183275ee/composer.json
10
11curl -o composer.lock https://raw.githubusercontent.com/composer/composer/d955458f271edb4fcc055a394f90a60a8328a2a8/composer.lock
12
13sha1sum composer.json > composer.json.sha1
14sha1sum composer.lock > composer.lock.sha1
15
16composer install
17
18sha1sum -c composer.json.sha1
19sha1sum -c composer.lock.sha1
20
21
that outputs:
composer.json: OK
composer.lock: OK
So both composer.json
and composer.lock
are not affected by composer install
so the only one thing to achieve the rollback (uninstall) of the composer install
is to remove the vendor
directory
1composer install
2composer remove *
3composer remove */*
4for package in $(composer show | awk '{print $1}'); do composer remove --no-interaction --dev --no-install "$package"; done
5composer --version
6mkdir -p /tmp/composer-install
7cd /tmp/composer-install
8
9curl -o composer.json https://raw.githubusercontent.com/composer/composer/18246212db7103d0a2688febcc336f77183275ee/composer.json
10
11curl -o composer.lock https://raw.githubusercontent.com/composer/composer/d955458f271edb4fcc055a394f90a60a8328a2a8/composer.lock
12
13sha1sum composer.json > composer.json.sha1
14sha1sum composer.lock > composer.lock.sha1
15
16composer install
17
18sha1sum -c composer.json.sha1
19sha1sum -c composer.lock.sha1
20
21rm -rf vendor
22
However as yivi mentioned:
If some other plugin (e.g Symfony Flex) makes changes to your existing files during the process, you'd better have the project on top of a version control system, in which case reverting is managed by VCS, not of composer.
I did not test against that case.
ANSWER
Answered 2022-Mar-14 at 18:581composer install
2composer remove *
3composer remove */*
4for package in $(composer show | awk '{print $1}'); do composer remove --no-interaction --dev --no-install "$package"; done
5composer --version
6mkdir -p /tmp/composer-install
7cd /tmp/composer-install
8
9curl -o composer.json https://raw.githubusercontent.com/composer/composer/18246212db7103d0a2688febcc336f77183275ee/composer.json
10
11curl -o composer.lock https://raw.githubusercontent.com/composer/composer/d955458f271edb4fcc055a394f90a60a8328a2a8/composer.lock
12
13sha1sum composer.json > composer.json.sha1
14sha1sum composer.lock > composer.lock.sha1
15
16composer install
17
18sha1sum -c composer.json.sha1
19sha1sum -c composer.lock.sha1
20
21rm -rf vendor
22rm -rf vendor
23
In any case, install
should not make any changes to a lockfile, so there shouldn't be anything to "revert" from an install
but deleting the installed files.
If the lockfile does not originally exist, then it will be created.
If some other plugin (e.g Symfony Flex) makes changes to your existing files during the process, you'd better have the project on top of a version control system, in which case reverting is managed by VCS, not of composer.
As my intention is to rollback to the state that did not have any package installed but only files: composer.lock and potentially composer.json
For you to be able to run composer install
at all, you need at the very least composer.json
to exist. install
reads from the lockfile (composer.lock
), but requires the JSON configuration file to exist as well. If the lockfile does not exist, update
will be run instead and the lockfile will be created.
I tried
composer remove
remove
is the opposite from require
. It removes packages from composer.json
, as require
adds them. Not the opposite of install
. There is no opposite of install, as it does not make much conceptual sense. If one needs to delete the installed project... one can always do so.
QUESTION
Get package source from sources.list.d
Asked 2022-Feb-18 at 21:42I want to download source for suricata package
I do add following repo
1sudo add-apt-repository ppa:oisf/suricata-stable
2
If I install package I get latest version
1sudo add-apt-repository ppa:oisf/suricata-stable
2$ suricata -V
3This is Suricata version 6.0.4 RELEASE
4
But when I try downloading source
1sudo add-apt-repository ppa:oisf/suricata-stable
2$ suricata -V
3This is Suricata version 6.0.4 RELEASE
4$ apt source suricata
5Reading package lists... Done
6NOTICE: 'suricata' packaging is maintained in the 'Git' version control system at:
7https://alioth.debian.org/anonscm/git/pkg-suricata/pkg-suricata.git
8Please use:
9git clone https://alioth.debian.org/anonscm/git/pkg-suricata/pkg-suricata.git
10to retrieve the latest (possibly unreleased) updates to the package.
11Need to get 11.8 MB of source archives.
12Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (dsc) [2,768 B]
13Get:2 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (tar) [11.7 MB]
14Get:3 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (diff) [20.3 kB]
15Fetched 11.8 MB in 1s (10.3 MB/s)
16dpkg-source: info: extracting suricata in suricata-3.2
17dpkg-source: info: unpacking suricata_3.2.orig.tar.gz
18dpkg-source: info: unpacking suricata_3.2-2ubuntu3.debian.tar.xz
19dpkg-source: info: applying reproducible.patch
20dpkg-source: info: applying debian-default-cfg.patch
21dpkg-source: info: applying optional-hyperscan.patch
22$ ls
23suricata-3.2 suricata_3.2-2ubuntu3.debian.tar.xz suricata_3.2-2ubuntu3.dsc
24suricata_3.2.orig.tar.gz
25
I get old version.
Is there a way to fetch source from newly added repo?
I did look into the git repo already, but I am more interested in the actual command of apt source
or something similar.
ANSWER
Answered 2022-Feb-18 at 21:32This line:
1sudo add-apt-repository ppa:oisf/suricata-stable
2$ suricata -V
3This is Suricata version 6.0.4 RELEASE
4$ apt source suricata
5Reading package lists... Done
6NOTICE: 'suricata' packaging is maintained in the 'Git' version control system at:
7https://alioth.debian.org/anonscm/git/pkg-suricata/pkg-suricata.git
8Please use:
9git clone https://alioth.debian.org/anonscm/git/pkg-suricata/pkg-suricata.git
10to retrieve the latest (possibly unreleased) updates to the package.
11Need to get 11.8 MB of source archives.
12Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (dsc) [2,768 B]
13Get:2 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (tar) [11.7 MB]
14Get:3 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (diff) [20.3 kB]
15Fetched 11.8 MB in 1s (10.3 MB/s)
16dpkg-source: info: extracting suricata in suricata-3.2
17dpkg-source: info: unpacking suricata_3.2.orig.tar.gz
18dpkg-source: info: unpacking suricata_3.2-2ubuntu3.debian.tar.xz
19dpkg-source: info: applying reproducible.patch
20dpkg-source: info: applying debian-default-cfg.patch
21dpkg-source: info: applying optional-hyperscan.patch
22$ ls
23suricata-3.2 suricata_3.2-2ubuntu3.debian.tar.xz suricata_3.2-2ubuntu3.dsc
24suricata_3.2.orig.tar.gz
25Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (dsc) [2,768 B]
26
will tell you from where the package has been downloaded, it is from universe
repository.
You need to enable the source package for the added PPA:
1sudo add-apt-repository ppa:oisf/suricata-stable
2$ suricata -V
3This is Suricata version 6.0.4 RELEASE
4$ apt source suricata
5Reading package lists... Done
6NOTICE: 'suricata' packaging is maintained in the 'Git' version control system at:
7https://alioth.debian.org/anonscm/git/pkg-suricata/pkg-suricata.git
8Please use:
9git clone https://alioth.debian.org/anonscm/git/pkg-suricata/pkg-suricata.git
10to retrieve the latest (possibly unreleased) updates to the package.
11Need to get 11.8 MB of source archives.
12Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (dsc) [2,768 B]
13Get:2 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (tar) [11.7 MB]
14Get:3 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (diff) [20.3 kB]
15Fetched 11.8 MB in 1s (10.3 MB/s)
16dpkg-source: info: extracting suricata in suricata-3.2
17dpkg-source: info: unpacking suricata_3.2.orig.tar.gz
18dpkg-source: info: unpacking suricata_3.2-2ubuntu3.debian.tar.xz
19dpkg-source: info: applying reproducible.patch
20dpkg-source: info: applying debian-default-cfg.patch
21dpkg-source: info: applying optional-hyperscan.patch
22$ ls
23suricata-3.2 suricata_3.2-2ubuntu3.debian.tar.xz suricata_3.2-2ubuntu3.dsc
24suricata_3.2.orig.tar.gz
25Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe suricata 3.2-2ubuntu3 (dsc) [2,768 B]
26echo "deb-src http://ppa.launchpad.net/oisf/suricata-stable/ubuntu bionic main" |
27sudo tee -a /etc/apt/sources.list.d/oisf-suricata-stable-bionic.list
28sudo apt update
29apt source suricata
30
QUESTION
Unable to access the API key using BuildConfig
Asked 2022-Feb-07 at 01:43I'm using secrets-gradle-plugin to read the API keys that I put in my local.properties.
I've added this code into the root build.gradle
1buildscript {
2 dependencies {
3 classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
4 }
5}
6
For app build.gradle
1buildscript {
2 dependencies {
3 classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
4 }
5}
6plugins {
7 id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
8}
9
10android {
11 compileSdk 31
12...
13}
14
And this is my local.properties
1buildscript {
2 dependencies {
3 classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
4 }
5}
6plugins {
7 id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
8}
9
10android {
11 compileSdk 31
12...
13}
14## This file must *NOT* be checked into Version Control Systems,
15# as it contains information specific to your local configuration.
16#
17# Location of the SDK. This is only used by Gradle.
18# For customization when using a Version Control System, please read the
19# header note.
20#
21sdk.dir=/Users/xxx/Library/Android/sdk
22apiKey=YOUR_API_KEY
23
Then when I tried to access it from any class/application BuildConfig.apiKey
is not there. Am I missing any steps here? Been trying for few hours but doesn't found any way to make this work.
ANSWER
Answered 2022-Feb-03 at 11:38try and add this line in
app/build.gradle
within thedefaultConfig
buildConfigField("String", "apiKey", API_KEY)
then try to fetch it
String apiKey = BuildConfig.apiKey;
QUESTION
First time Git user, Push to remote repository takes forever
Asked 2021-Nov-18 at 15:39Win 10, using Git bash. Git version 2.32.0.windows.1. Researched similar/same topics, they didn't help.
I'm a new user of Git, trying to learn how to use it, never used version control systems before, and I don't have anyone fleshy to ask or show me.
I follow the tutorial and even understand what's going on so far, but the push to the remote repository takes forever and does nothing. Everything up to that point worked.
Tutorial I'm using: YouTube Link with timestamp
What I successfully managed to do: created my first local repo, created dummy test file (took a random script for PCB CAD program with a bit of text, doesn't matter I guess), learned to create a branch and commit stuff to local branches. My head is about to explode, but it works, and I understand it so far. But pushing to remote repo hangs without giving any hint or clue.
I did a bit of research and found this topic here on StackOverflow: link
I added --verbose to the push command, so now it looks like this:
1$ git push -u --verbose origin main
2Pushing to https://github.com/ellectroid/test_public_repository.git
3
And then it hangs forever. Highly uninformative.
Also, in the stackoverflow post in the link above someone talks about protocols. I tried http and https. No difference.
Then someone (goes by Azeez) said to ensure I'm authenticated on GitHub. Well, I'm logged in in the browser, although I don't understand how that is connected, but I'm logged in. And then in the same post they write some quote:
Select an authentication method for 'https://github.com/':
- Web browser (default)
- Personal access token option (enter for default):
I have zero clue what this is, I was never asked to authenticate anything in the bash, and I have no clue how to do it. The tutorial doesn't do it and everything works there out of the box.
I'm a 100% Git and GitHub noob, registered an account like half a year ago, but today is my first day of actually trying to use it, and I immediately get this in the face without any clue as to why and what to do, so I would appreciate if your reply explained what to do in detail. I just want to be able to push what I have in my local repo to the GitHub.
I'm not using any proxy or anything, if that matters.
If you need more information from me, please tell me what information and where do I get that information. As I said, I don't know anything about Git yet, but very much want to.
P.S. I'm aware about master and main branch names and accounted for it.
UPDATE
On the next day when I tried to push, a Git GUI popped up with openSSH in window title asking me for GitHub username. I entered my username, which was for some reason all with asterisks (never seen login written with asterisks), I entered my GitHub username "ellectroid" and got "Application error" window with text "Error: error writing "stdout": broken pipe". I opened detailed error message, it says:
1$ git push -u --verbose origin main
2Pushing to https://github.com/ellectroid/test_public_repository.git
3 error writing "stdout": broken pipe
4error writing "stdout": broken pipe
5 while executing
6"puts $::answer"
7 (procedure "finish" line 14)
8 invoked from within
9"finish"
10 invoked from within
11".b.ok invoke"
12 ("uplevel" body line 1)
13 invoked from within
14"uplevel #0 [list $w invoke]"
15 (procedure "tk::ButtonUp" line 24)
16 invoked from within
17"tk::ButtonUp .b.ok"
18 (command bound to event)
19
UPDATE 2 After extensive googling I found what person in the comments was talking about. Turns out there is a file with the name "config" without extension in the hidden folder .git in my local repo (was it difficult to explain like this? Sorry, I said I'm noob, you could word it friendlier for noobs), so here are the contents of this "config" file:
1$ git push -u --verbose origin main
2Pushing to https://github.com/ellectroid/test_public_repository.git
3 error writing "stdout": broken pipe
4error writing "stdout": broken pipe
5 while executing
6"puts $::answer"
7 (procedure "finish" line 14)
8 invoked from within
9"finish"
10 invoked from within
11".b.ok invoke"
12 ("uplevel" body line 1)
13 invoked from within
14"uplevel #0 [list $w invoke]"
15 (procedure "tk::ButtonUp" line 24)
16 invoked from within
17"tk::ButtonUp .b.ok"
18 (command bound to event)
19[core]
20 repositoryformatversion = 0
21 filemode = false
22 bare = false
23 logallrefupdates = true
24 symlinks = false
25 ignorecase = true
26[remote "origin"]
27 url = https://github.com/ellectroid/test_public_repository.git
28 fetch = +refs/heads/*:refs/remotes/origin/*
29[remote "origin2"]
30 url = http://github.com/ellectroid/test_public_repository.git
31 fetch = +refs/heads/*:refs/remotes/origin2/*
32
I tried origin2 to try with http instead of https. I still get error when authenticating on github in Git GUI OpenSSH window, where I enter my login with asterisks ("ellectroid") and it spews out broken pipe error like above.
UPDATE 3
Thanks to @VonC, who invited me to the chat, we figured out all I had to do is to push not from the Git Bash, but from Windows CMD. Then, when I push, it immediately prompted me to use Personal Access Token, which I already created. Also, I did it with admin rights. Later on I changed environment variable PATH to include path to bash, so I can just write "bash" in CMD and get fancy colors and stuff. Case closed.
ANSWER
Answered 2021-Nov-18 at 15:08On Windows, try and push from the command-line (not from a GUI) to test if that would be working.
Make sure that, in a simple CMD:
git config credential.helper
does returnmanager-core
- git ls-remote https://github.com// triggers a popup where you can enter your GitHub user account name and your PAT (Personal Access Token that you need to create first)
Then try and git push
from within your local repository folder.
From the discussion, this started to work with:
C:\Program Files\Git\bin
, so you need to add it to the system PATH (it is wherebash.exe
is)- a CMD opened as Administrator
QUESTION
Should I be adding the Django migration files in the .dockerignore /.gitignore file?
Asked 2021-Nov-17 at 16:12This is probably a duplicate of this question.
My question is how should I approach this when working in a docker environment so for my project I have a docker-compose.yml and docker-compose-deploy.yml for my production environment and obviously migration files are generated only in the docker images and aren't included in my version control system.
How should I approach this? should I stop using Docker as my development environment and go for something like virtual environments or even machines?
ANSWER
Answered 2021-Nov-17 at 16:12No. The migration files are there so you can update your database without destroying it and rebuilding it from scratch (or doing the sql update statements by hand).
So you definitely want to track them in your version control.
During development, a classic scenario would be
- write code
- make migrations
- apply migrations on your dev database
- test the changes locally
- check in and push the commit to your production server
- execute the migrations (so only do
python manage.py migrate
) in production
Edit: I forgot to answer your docker question. Usually you put your source code in a volume outside the container, that you then mount into the container. So you can do docker development like this. That way the migration files and up in your codebase and you can track it.
QUESTION
How can I find all common sub strings using Rust , Python, javascript?
Asked 2021-Nov-04 at 02:16Git is an awesome version control system, I want learn git by writing my own version control system. The first step I have to do is implement a string diff tool. I've read this blog and this paper. In order to get the diff of two strings, I need to locate the common part. Hence, I came into the problem: How can I find all common sub strings of two strings?
This is first part of my problem:The algorithm problem.
This is the algorithm I am using:
Algorithm Problem【Problem】Find all common sub strings of string1 and string2.
【Solution】
- compare all sub string of string1 with string2 then gather matches into answer.
- compare all sub string of string2 with string1 then gather matches into answer.
This algorithm is O(N^2) time complex.
The language ProblemTo proof my thought, I can easily implement it with Python:
1def commonSubstringFinder(string1, string2):
2 answer=[]
3 len1, len2 = len(string1), len(string2)
4 match = ""
5 x,y = 0,0
6 for i in range(len2):
7 for j in range(len1):
8 if ( i+j < len2) and (string1[j] == string2[i+j]):
9 if len(match)==0:
10 x,y=i+j,j
11 match += string1[j]
12 else:
13 if len(match)>0:
14 answer.append(((x,y), match))
15 match=""
16
17 for i in range(1,len1):
18 for j in range(len2):
19 if (i+j<len1 and string1[i+j] == string2[j] ):
20 if len(match)==0:
21 x,y=j,i+j
22 match += string2[j]
23 else:
24 if len(match)>0:
25 answer.append(((x,y), match))
26 match=""
27
28 return answer
29
30print(commonSubstringFinder("apkleses", "appleses"))
31print(commonSubstringFinder("cappleses", "caplekses"))
32
33# [((0, 0), 'ap'), ((3, 3), 'leses'), ((2, 1), 'p'), ((6, 4), 'es'), ((4, 6), 'es')]
34# [((0, 0), 'cap'), ((6, 6), 'ses'), ((7, 5), 'es'), ((2, 3), 'ple'), ((6, 8), 's'), ((4, 7), 'e')]
35
36
However, It's really hard for me to migrate this algrithom by using Rust Programming language. The problem is Rust programming language always uses iter(say string1.chars()
) to get chars instead of index.
Any 🦀 can help me?
ConclusionI found an interesting thing when I solve this problem: How Do biologists find the common part of two DNA or RNA?
ANSWER
Answered 2021-Nov-04 at 02:16I find Google's awesome repo:
👉 https://github.com/google/diff-match-patch
But there is no rust language 🦀.
Old answerThanks for your reply. I've found a simple solution here.
Welcome to upgrade it 😘:
1def commonSubstringFinder(string1, string2):
2 answer=[]
3 len1, len2 = len(string1), len(string2)
4 match = ""
5 x,y = 0,0
6 for i in range(len2):
7 for j in range(len1):
8 if ( i+j < len2) and (string1[j] == string2[i+j]):
9 if len(match)==0:
10 x,y=i+j,j
11 match += string1[j]
12 else:
13 if len(match)>0:
14 answer.append(((x,y), match))
15 match=""
16
17 for i in range(1,len1):
18 for j in range(len2):
19 if (i+j<len1 and string1[i+j] == string2[j] ):
20 if len(match)==0:
21 x,y=j,i+j
22 match += string2[j]
23 else:
24 if len(match)>0:
25 answer.append(((x,y), match))
26 match=""
27
28 return answer
29
30print(commonSubstringFinder("apkleses", "appleses"))
31print(commonSubstringFinder("cappleses", "caplekses"))
32
33# [((0, 0), 'ap'), ((3, 3), 'leses'), ((2, 1), 'p'), ((6, 4), 'es'), ((4, 6), 'es')]
34# [((0, 0), 'cap'), ((6, 6), 'ses'), ((7, 5), 'es'), ((2, 3), 'ple'), ((6, 8), 's'), ((4, 7), 'e')]
35
36#![allow(unused)]
37
38#[derive(Debug)]
39struct Common(u32, String);
40
41pub fn common(old_content: &str, new_content: &str) {
42 let mut commons: Vec<Common> = vec![];
43
44 let mut sub = String::new();
45 // cdx is the start index of common substring in old content.
46 let mut cdx = 0u32;
47 let mut idx = 0u32; // inner loop counter
48 let mut odx = 0u32; // outer loop counter
49 let mut new_iter = new_content.chars().peekable();
50 while (!new_iter.peek().is_none()) {
51 for (old_ch, new_ch) in old_content.chars().zip(new_iter.clone()) {
52 if old_ch == new_ch {
53 if sub.is_empty() {
54 cdx = idx;
55 }
56 sub.push(old_ch);
57 } else {
58 if sub.len() > 0 {
59 commons.push(Common(cdx, sub.clone()));
60 sub.clear();
61 }
62 }
63 idx += 1;
64 }
65 new_iter.next();
66 odx += 1;
67 idx = 0;
68 }
69
70 odx = 1;
71 idx = 0;
72 let mut old_iter = old_content.chars().skip(1).peekable();
73 while (!old_iter.peek().is_none()) {
74 for (new_ch, old_ch) in new_content.chars().zip(old_iter.clone()) {
75 if old_ch == new_ch {
76 if sub.is_empty() {
77 cdx = odx + idx;
78 }
79 sub.push(old_ch);
80 } else {
81 if sub.len() > 0 {
82 commons.push(Common(cdx, sub.clone()));
83 sub.clear();
84 }
85 }
86 idx += 1;
87 }
88 old_iter.next();
89 odx += 1;
90 idx = 0;
91 }
92 println!("{:?}", commons);
93}
94
95#[cfg(test)]
96mod tests {
97 use self::super::*;
98 #[test]
99 fn test_common() {
100 // test with print output: cargo test -- --nocapture
101 common("apkleses", "appleses");
102 common("cappleses", "caplekses");
103 }
104}
105
106
The solution may not be rusty, but it worked.
update on 2021-11-3I find a non iterator solution:collect elements into a Vec.
QUESTION
Error opening the database 'objectbox': In entity "Album", property "artistId": missing virtualTarget
Asked 2021-Sep-27 at 06:13I am trying to set up the sync server with docker on Windows, but I get "Error opening the database 'objectbox': In entity "Album", property "artistId": missing virtualTarget" after running this command: docker run --rm -it -v %cd%:/data --publish 127.0.0.1:9999:9999 --publish 127.0.0.1:9980:9980 --user=0 objectboxio/sync:21.5.14-server --model /data/objectbox-model.json --unsecured-no-authentication --browser-bind 0.0.0.0:9980
Here is my model.json:
1{
2 "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
3 "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
4 "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
5 "entities": [
6 {
7 "id": "1:5798298704074413534",
8 "lastPropertyId": "3:47976863942241076",
9 "name": "Album",
10 "flags": 2,
11 "properties": [
12 {
13 "id": "1:2766334915860083274",
14 "name": "id",
15 "type": 6,
16 "flags": 1
17 },
18 {
19 "id": "2:7127912550768516753",
20 "name": "title",
21 "type": 9
22 },
23 {
24 "id": "3:47976863942241076",
25 "name": "artistId",
26 "indexId": "1:5025869377329785302",
27 "type": 11,
28 "flags": 1548,
29 "relationTarget": "Artist"
30 }
31 ],
32 "relations": []
33 },
34 {
35 "id": "2:3610255661907547309",
36 "lastPropertyId": "2:866597986492054995",
37 "name": "Artist",
38 "flags": 2,
39 "properties": [
40 {
41 "id": "1:8211995468434539608",
42 "name": "id",
43 "type": 6,
44 "flags": 1
45 },
46 {
47 "id": "2:866597986492054995",
48 "name": "name",
49 "type": 9
50 }
51 ],
52 "relations": []
53 },
54 {
55 "id": "3:7162260877203742605",
56 "lastPropertyId": "5:3077441054734333760",
57 "name": "Customer",
58 "flags": 2,
59 "properties": [
60 {
61 "id": "1:1334004294809772177",
62 "name": "id",
63 "type": 6,
64 "flags": 1
65 },
66 {
67 "id": "2:8500254104736767378",
68 "name": "firstName",
69 "type": 9
70 },
71 {
72 "id": "3:1261795948739215169",
73 "name": "lastName",
74 "type": 9
75 },
76 {
77 "id": "4:8863096110280655355",
78 "name": "phone",
79 "type": 9
80 },
81 {
82 "id": "5:3077441054734333760",
83 "name": "email",
84 "type": 9
85 }
86 ],
87 "relations": []
88 },
89 {
90 "id": "4:720703670162855056",
91 "lastPropertyId": "4:5690325342466026680",
92 "name": "Invoice",
93 "flags": 2,
94 "properties": [
95 {
96 "id": "1:1570181203114245602",
97 "name": "id",
98 "type": 6,
99 "flags": 1
100 },
101 {
102 "id": "2:4307795986019697116",
103 "name": "date",
104 "type": 10
105 },
106 {
107 "id": "3:5403205385433436440",
108 "name": "total",
109 "type": 8,
110 "flags": 4
111 },
112 {
113 "id": "4:5690325342466026680",
114 "name": "customerId",
115 "indexId": "2:8233264265765179610",
116 "type": 11,
117 "flags": 1548,
118 "relationTarget": "Customer"
119 }
120 ],
121 "relations": []
122 },
123 {
124 "id": "5:2124535126347251014",
125 "lastPropertyId": "5:600965215010068015",
126 "name": "InvoiceItem",
127 "flags": 2,
128 "properties": [
129 {
130 "id": "1:3893797232755033190",
131 "name": "id",
132 "type": 6,
133 "flags": 1
134 },
135 {
136 "id": "2:3484774170370690529",
137 "name": "unitPrice",
138 "type": 8,
139 "flags": 4
140 },
141 {
142 "id": "3:5271985023292199596",
143 "name": "quantity",
144 "type": 5,
145 "flags": 4
146 },
147 {
148 "id": "4:7557084807279778428",
149 "name": "invoiceId",
150 "indexId": "3:1116397924317199080",
151 "type": 11,
152 "flags": 1548,
153 "relationTarget": "Invoice"
154 },
155 {
156 "id": "5:600965215010068015",
157 "name": "trackId",
158 "indexId": "4:1677643892085601951",
159 "type": 11,
160 "flags": 1548,
161 "relationTarget": "Track"
162 }
163 ],
164 "relations": []
165 },
166 {
167 "id": "6:828952092407258806",
168 "lastPropertyId": "5:8273078892571453738",
169 "name": "Track",
170 "flags": 2,
171 "properties": [
172 {
173 "id": "1:4902677122121855061",
174 "name": "id",
175 "type": 6,
176 "flags": 1
177 },
178 {
179 "id": "2:1219132270817494543",
180 "name": "name",
181 "type": 9
182 },
183 {
184 "id": "3:3607878157603664853",
185 "name": "unitPrice",
186 "type": 8,
187 "flags": 4
188 },
189 {
190 "id": "4:2322328496342192994",
191 "name": "stock",
192 "type": 5,
193 "flags": 4
194 },
195 {
196 "id": "5:8273078892571453738",
197 "name": "albumId",
198 "indexId": "5:1459310406895714984",
199 "type": 11,
200 "flags": 1548,
201 "relationTarget": "Album"
202 }
203 ],
204 "relations": []
205 }
206 ],
207 "lastEntityId": "6:828952092407258806",
208 "lastIndexId": "5:1459310406895714984",
209 "lastRelationId": "0:0",
210 "lastSequenceId": "0:0",
211 "modelVersion": 5,
212 "modelVersionParserMinimum": 5,
213 "retiredEntityUids": [],
214 "retiredIndexUids": [],
215 "retiredPropertyUids": [],
216 "retiredRelationUids": [],
217 "version": 1
218}
219
The classes:
1{
2 "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
3 "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
4 "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
5 "entities": [
6 {
7 "id": "1:5798298704074413534",
8 "lastPropertyId": "3:47976863942241076",
9 "name": "Album",
10 "flags": 2,
11 "properties": [
12 {
13 "id": "1:2766334915860083274",
14 "name": "id",
15 "type": 6,
16 "flags": 1
17 },
18 {
19 "id": "2:7127912550768516753",
20 "name": "title",
21 "type": 9
22 },
23 {
24 "id": "3:47976863942241076",
25 "name": "artistId",
26 "indexId": "1:5025869377329785302",
27 "type": 11,
28 "flags": 1548,
29 "relationTarget": "Artist"
30 }
31 ],
32 "relations": []
33 },
34 {
35 "id": "2:3610255661907547309",
36 "lastPropertyId": "2:866597986492054995",
37 "name": "Artist",
38 "flags": 2,
39 "properties": [
40 {
41 "id": "1:8211995468434539608",
42 "name": "id",
43 "type": 6,
44 "flags": 1
45 },
46 {
47 "id": "2:866597986492054995",
48 "name": "name",
49 "type": 9
50 }
51 ],
52 "relations": []
53 },
54 {
55 "id": "3:7162260877203742605",
56 "lastPropertyId": "5:3077441054734333760",
57 "name": "Customer",
58 "flags": 2,
59 "properties": [
60 {
61 "id": "1:1334004294809772177",
62 "name": "id",
63 "type": 6,
64 "flags": 1
65 },
66 {
67 "id": "2:8500254104736767378",
68 "name": "firstName",
69 "type": 9
70 },
71 {
72 "id": "3:1261795948739215169",
73 "name": "lastName",
74 "type": 9
75 },
76 {
77 "id": "4:8863096110280655355",
78 "name": "phone",
79 "type": 9
80 },
81 {
82 "id": "5:3077441054734333760",
83 "name": "email",
84 "type": 9
85 }
86 ],
87 "relations": []
88 },
89 {
90 "id": "4:720703670162855056",
91 "lastPropertyId": "4:5690325342466026680",
92 "name": "Invoice",
93 "flags": 2,
94 "properties": [
95 {
96 "id": "1:1570181203114245602",
97 "name": "id",
98 "type": 6,
99 "flags": 1
100 },
101 {
102 "id": "2:4307795986019697116",
103 "name": "date",
104 "type": 10
105 },
106 {
107 "id": "3:5403205385433436440",
108 "name": "total",
109 "type": 8,
110 "flags": 4
111 },
112 {
113 "id": "4:5690325342466026680",
114 "name": "customerId",
115 "indexId": "2:8233264265765179610",
116 "type": 11,
117 "flags": 1548,
118 "relationTarget": "Customer"
119 }
120 ],
121 "relations": []
122 },
123 {
124 "id": "5:2124535126347251014",
125 "lastPropertyId": "5:600965215010068015",
126 "name": "InvoiceItem",
127 "flags": 2,
128 "properties": [
129 {
130 "id": "1:3893797232755033190",
131 "name": "id",
132 "type": 6,
133 "flags": 1
134 },
135 {
136 "id": "2:3484774170370690529",
137 "name": "unitPrice",
138 "type": 8,
139 "flags": 4
140 },
141 {
142 "id": "3:5271985023292199596",
143 "name": "quantity",
144 "type": 5,
145 "flags": 4
146 },
147 {
148 "id": "4:7557084807279778428",
149 "name": "invoiceId",
150 "indexId": "3:1116397924317199080",
151 "type": 11,
152 "flags": 1548,
153 "relationTarget": "Invoice"
154 },
155 {
156 "id": "5:600965215010068015",
157 "name": "trackId",
158 "indexId": "4:1677643892085601951",
159 "type": 11,
160 "flags": 1548,
161 "relationTarget": "Track"
162 }
163 ],
164 "relations": []
165 },
166 {
167 "id": "6:828952092407258806",
168 "lastPropertyId": "5:8273078892571453738",
169 "name": "Track",
170 "flags": 2,
171 "properties": [
172 {
173 "id": "1:4902677122121855061",
174 "name": "id",
175 "type": 6,
176 "flags": 1
177 },
178 {
179 "id": "2:1219132270817494543",
180 "name": "name",
181 "type": 9
182 },
183 {
184 "id": "3:3607878157603664853",
185 "name": "unitPrice",
186 "type": 8,
187 "flags": 4
188 },
189 {
190 "id": "4:2322328496342192994",
191 "name": "stock",
192 "type": 5,
193 "flags": 4
194 },
195 {
196 "id": "5:8273078892571453738",
197 "name": "albumId",
198 "indexId": "5:1459310406895714984",
199 "type": 11,
200 "flags": 1548,
201 "relationTarget": "Album"
202 }
203 ],
204 "relations": []
205 }
206 ],
207 "lastEntityId": "6:828952092407258806",
208 "lastIndexId": "5:1459310406895714984",
209 "lastRelationId": "0:0",
210 "lastSequenceId": "0:0",
211 "modelVersion": 5,
212 "modelVersionParserMinimum": 5,
213 "retiredEntityUids": [],
214 "retiredIndexUids": [],
215 "retiredPropertyUids": [],
216 "retiredRelationUids": [],
217 "version": 1
218}
219@Sync
220@Entity
221public class Album {
222 @Id
223 public long id;
224 public String title;
225 //public long artistId;
226 public ToOne<Artist> artist;
227 @Backlink(to = "album")
228 public ToMany<Track> tracks;
229
230 public Album(){}
231
232 public Album(long id, String title, long artistId){
233 this.id = id;
234 this.title = title;
235 this.artist.setTargetId(artistId);
236 }
237}
238
1{
2 "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
3 "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
4 "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
5 "entities": [
6 {
7 "id": "1:5798298704074413534",
8 "lastPropertyId": "3:47976863942241076",
9 "name": "Album",
10 "flags": 2,
11 "properties": [
12 {
13 "id": "1:2766334915860083274",
14 "name": "id",
15 "type": 6,
16 "flags": 1
17 },
18 {
19 "id": "2:7127912550768516753",
20 "name": "title",
21 "type": 9
22 },
23 {
24 "id": "3:47976863942241076",
25 "name": "artistId",
26 "indexId": "1:5025869377329785302",
27 "type": 11,
28 "flags": 1548,
29 "relationTarget": "Artist"
30 }
31 ],
32 "relations": []
33 },
34 {
35 "id": "2:3610255661907547309",
36 "lastPropertyId": "2:866597986492054995",
37 "name": "Artist",
38 "flags": 2,
39 "properties": [
40 {
41 "id": "1:8211995468434539608",
42 "name": "id",
43 "type": 6,
44 "flags": 1
45 },
46 {
47 "id": "2:866597986492054995",
48 "name": "name",
49 "type": 9
50 }
51 ],
52 "relations": []
53 },
54 {
55 "id": "3:7162260877203742605",
56 "lastPropertyId": "5:3077441054734333760",
57 "name": "Customer",
58 "flags": 2,
59 "properties": [
60 {
61 "id": "1:1334004294809772177",
62 "name": "id",
63 "type": 6,
64 "flags": 1
65 },
66 {
67 "id": "2:8500254104736767378",
68 "name": "firstName",
69 "type": 9
70 },
71 {
72 "id": "3:1261795948739215169",
73 "name": "lastName",
74 "type": 9
75 },
76 {
77 "id": "4:8863096110280655355",
78 "name": "phone",
79 "type": 9
80 },
81 {
82 "id": "5:3077441054734333760",
83 "name": "email",
84 "type": 9
85 }
86 ],
87 "relations": []
88 },
89 {
90 "id": "4:720703670162855056",
91 "lastPropertyId": "4:5690325342466026680",
92 "name": "Invoice",
93 "flags": 2,
94 "properties": [
95 {
96 "id": "1:1570181203114245602",
97 "name": "id",
98 "type": 6,
99 "flags": 1
100 },
101 {
102 "id": "2:4307795986019697116",
103 "name": "date",
104 "type": 10
105 },
106 {
107 "id": "3:5403205385433436440",
108 "name": "total",
109 "type": 8,
110 "flags": 4
111 },
112 {
113 "id": "4:5690325342466026680",
114 "name": "customerId",
115 "indexId": "2:8233264265765179610",
116 "type": 11,
117 "flags": 1548,
118 "relationTarget": "Customer"
119 }
120 ],
121 "relations": []
122 },
123 {
124 "id": "5:2124535126347251014",
125 "lastPropertyId": "5:600965215010068015",
126 "name": "InvoiceItem",
127 "flags": 2,
128 "properties": [
129 {
130 "id": "1:3893797232755033190",
131 "name": "id",
132 "type": 6,
133 "flags": 1
134 },
135 {
136 "id": "2:3484774170370690529",
137 "name": "unitPrice",
138 "type": 8,
139 "flags": 4
140 },
141 {
142 "id": "3:5271985023292199596",
143 "name": "quantity",
144 "type": 5,
145 "flags": 4
146 },
147 {
148 "id": "4:7557084807279778428",
149 "name": "invoiceId",
150 "indexId": "3:1116397924317199080",
151 "type": 11,
152 "flags": 1548,
153 "relationTarget": "Invoice"
154 },
155 {
156 "id": "5:600965215010068015",
157 "name": "trackId",
158 "indexId": "4:1677643892085601951",
159 "type": 11,
160 "flags": 1548,
161 "relationTarget": "Track"
162 }
163 ],
164 "relations": []
165 },
166 {
167 "id": "6:828952092407258806",
168 "lastPropertyId": "5:8273078892571453738",
169 "name": "Track",
170 "flags": 2,
171 "properties": [
172 {
173 "id": "1:4902677122121855061",
174 "name": "id",
175 "type": 6,
176 "flags": 1
177 },
178 {
179 "id": "2:1219132270817494543",
180 "name": "name",
181 "type": 9
182 },
183 {
184 "id": "3:3607878157603664853",
185 "name": "unitPrice",
186 "type": 8,
187 "flags": 4
188 },
189 {
190 "id": "4:2322328496342192994",
191 "name": "stock",
192 "type": 5,
193 "flags": 4
194 },
195 {
196 "id": "5:8273078892571453738",
197 "name": "albumId",
198 "indexId": "5:1459310406895714984",
199 "type": 11,
200 "flags": 1548,
201 "relationTarget": "Album"
202 }
203 ],
204 "relations": []
205 }
206 ],
207 "lastEntityId": "6:828952092407258806",
208 "lastIndexId": "5:1459310406895714984",
209 "lastRelationId": "0:0",
210 "lastSequenceId": "0:0",
211 "modelVersion": 5,
212 "modelVersionParserMinimum": 5,
213 "retiredEntityUids": [],
214 "retiredIndexUids": [],
215 "retiredPropertyUids": [],
216 "retiredRelationUids": [],
217 "version": 1
218}
219@Sync
220@Entity
221public class Album {
222 @Id
223 public long id;
224 public String title;
225 //public long artistId;
226 public ToOne<Artist> artist;
227 @Backlink(to = "album")
228 public ToMany<Track> tracks;
229
230 public Album(){}
231
232 public Album(long id, String title, long artistId){
233 this.id = id;
234 this.title = title;
235 this.artist.setTargetId(artistId);
236 }
237}
238@Sync
239@Entity
240public class Artist {
241 @Id
242 public long id;
243 public String name;
244 @Backlink(to = "artist")
245 public ToMany<Album> albums;
246
247 public Artist(){}
248
249 public Artist(long id, String name){
250 this.id = id;
251 this.name = name;
252 }
253}
254
I created my entities based on https://docs.objectbox.io/relations, I am new to objectbox so sorry if the mistake is obvious.
EDIT: I put here the gradle files just in case I missed something there.
1{
2 "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
3 "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
4 "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
5 "entities": [
6 {
7 "id": "1:5798298704074413534",
8 "lastPropertyId": "3:47976863942241076",
9 "name": "Album",
10 "flags": 2,
11 "properties": [
12 {
13 "id": "1:2766334915860083274",
14 "name": "id",
15 "type": 6,
16 "flags": 1
17 },
18 {
19 "id": "2:7127912550768516753",
20 "name": "title",
21 "type": 9
22 },
23 {
24 "id": "3:47976863942241076",
25 "name": "artistId",
26 "indexId": "1:5025869377329785302",
27 "type": 11,
28 "flags": 1548,
29 "relationTarget": "Artist"
30 }
31 ],
32 "relations": []
33 },
34 {
35 "id": "2:3610255661907547309",
36 "lastPropertyId": "2:866597986492054995",
37 "name": "Artist",
38 "flags": 2,
39 "properties": [
40 {
41 "id": "1:8211995468434539608",
42 "name": "id",
43 "type": 6,
44 "flags": 1
45 },
46 {
47 "id": "2:866597986492054995",
48 "name": "name",
49 "type": 9
50 }
51 ],
52 "relations": []
53 },
54 {
55 "id": "3:7162260877203742605",
56 "lastPropertyId": "5:3077441054734333760",
57 "name": "Customer",
58 "flags": 2,
59 "properties": [
60 {
61 "id": "1:1334004294809772177",
62 "name": "id",
63 "type": 6,
64 "flags": 1
65 },
66 {
67 "id": "2:8500254104736767378",
68 "name": "firstName",
69 "type": 9
70 },
71 {
72 "id": "3:1261795948739215169",
73 "name": "lastName",
74 "type": 9
75 },
76 {
77 "id": "4:8863096110280655355",
78 "name": "phone",
79 "type": 9
80 },
81 {
82 "id": "5:3077441054734333760",
83 "name": "email",
84 "type": 9
85 }
86 ],
87 "relations": []
88 },
89 {
90 "id": "4:720703670162855056",
91 "lastPropertyId": "4:5690325342466026680",
92 "name": "Invoice",
93 "flags": 2,
94 "properties": [
95 {
96 "id": "1:1570181203114245602",
97 "name": "id",
98 "type": 6,
99 "flags": 1
100 },
101 {
102 "id": "2:4307795986019697116",
103 "name": "date",
104 "type": 10
105 },
106 {
107 "id": "3:5403205385433436440",
108 "name": "total",
109 "type": 8,
110 "flags": 4
111 },
112 {
113 "id": "4:5690325342466026680",
114 "name": "customerId",
115 "indexId": "2:8233264265765179610",
116 "type": 11,
117 "flags": 1548,
118 "relationTarget": "Customer"
119 }
120 ],
121 "relations": []
122 },
123 {
124 "id": "5:2124535126347251014",
125 "lastPropertyId": "5:600965215010068015",
126 "name": "InvoiceItem",
127 "flags": 2,
128 "properties": [
129 {
130 "id": "1:3893797232755033190",
131 "name": "id",
132 "type": 6,
133 "flags": 1
134 },
135 {
136 "id": "2:3484774170370690529",
137 "name": "unitPrice",
138 "type": 8,
139 "flags": 4
140 },
141 {
142 "id": "3:5271985023292199596",
143 "name": "quantity",
144 "type": 5,
145 "flags": 4
146 },
147 {
148 "id": "4:7557084807279778428",
149 "name": "invoiceId",
150 "indexId": "3:1116397924317199080",
151 "type": 11,
152 "flags": 1548,
153 "relationTarget": "Invoice"
154 },
155 {
156 "id": "5:600965215010068015",
157 "name": "trackId",
158 "indexId": "4:1677643892085601951",
159 "type": 11,
160 "flags": 1548,
161 "relationTarget": "Track"
162 }
163 ],
164 "relations": []
165 },
166 {
167 "id": "6:828952092407258806",
168 "lastPropertyId": "5:8273078892571453738",
169 "name": "Track",
170 "flags": 2,
171 "properties": [
172 {
173 "id": "1:4902677122121855061",
174 "name": "id",
175 "type": 6,
176 "flags": 1
177 },
178 {
179 "id": "2:1219132270817494543",
180 "name": "name",
181 "type": 9
182 },
183 {
184 "id": "3:3607878157603664853",
185 "name": "unitPrice",
186 "type": 8,
187 "flags": 4
188 },
189 {
190 "id": "4:2322328496342192994",
191 "name": "stock",
192 "type": 5,
193 "flags": 4
194 },
195 {
196 "id": "5:8273078892571453738",
197 "name": "albumId",
198 "indexId": "5:1459310406895714984",
199 "type": 11,
200 "flags": 1548,
201 "relationTarget": "Album"
202 }
203 ],
204 "relations": []
205 }
206 ],
207 "lastEntityId": "6:828952092407258806",
208 "lastIndexId": "5:1459310406895714984",
209 "lastRelationId": "0:0",
210 "lastSequenceId": "0:0",
211 "modelVersion": 5,
212 "modelVersionParserMinimum": 5,
213 "retiredEntityUids": [],
214 "retiredIndexUids": [],
215 "retiredPropertyUids": [],
216 "retiredRelationUids": [],
217 "version": 1
218}
219@Sync
220@Entity
221public class Album {
222 @Id
223 public long id;
224 public String title;
225 //public long artistId;
226 public ToOne<Artist> artist;
227 @Backlink(to = "album")
228 public ToMany<Track> tracks;
229
230 public Album(){}
231
232 public Album(long id, String title, long artistId){
233 this.id = id;
234 this.title = title;
235 this.artist.setTargetId(artistId);
236 }
237}
238@Sync
239@Entity
240public class Artist {
241 @Id
242 public long id;
243 public String name;
244 @Backlink(to = "artist")
245 public ToMany<Album> albums;
246
247 public Artist(){}
248
249 public Artist(long id, String name){
250 this.id = id;
251 this.name = name;
252 }
253}
254buildscript {
255 ext.objectboxVersion = '2.9.2-RC4'
256 repositories {
257 google()
258 //jcenter()
259 mavenCentral()
260 }
261 dependencies {
262 classpath "com.android.tools.build:gradle:4.1.2"
263 classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
264 // NOTE: Do not place your application dependencies here; they belong
265 // in the individual module build.gradle files
266 }
267}
268
269allprojects {
270 repositories {
271 google()
272 //jcenter()
273 mavenCentral()
274 }
275}
276
277task clean(type: Delete) {
278 delete rootProject.buildDir
279}
280
1{
2 "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
3 "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
4 "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
5 "entities": [
6 {
7 "id": "1:5798298704074413534",
8 "lastPropertyId": "3:47976863942241076",
9 "name": "Album",
10 "flags": 2,
11 "properties": [
12 {
13 "id": "1:2766334915860083274",
14 "name": "id",
15 "type": 6,
16 "flags": 1
17 },
18 {
19 "id": "2:7127912550768516753",
20 "name": "title",
21 "type": 9
22 },
23 {
24 "id": "3:47976863942241076",
25 "name": "artistId",
26 "indexId": "1:5025869377329785302",
27 "type": 11,
28 "flags": 1548,
29 "relationTarget": "Artist"
30 }
31 ],
32 "relations": []
33 },
34 {
35 "id": "2:3610255661907547309",
36 "lastPropertyId": "2:866597986492054995",
37 "name": "Artist",
38 "flags": 2,
39 "properties": [
40 {
41 "id": "1:8211995468434539608",
42 "name": "id",
43 "type": 6,
44 "flags": 1
45 },
46 {
47 "id": "2:866597986492054995",
48 "name": "name",
49 "type": 9
50 }
51 ],
52 "relations": []
53 },
54 {
55 "id": "3:7162260877203742605",
56 "lastPropertyId": "5:3077441054734333760",
57 "name": "Customer",
58 "flags": 2,
59 "properties": [
60 {
61 "id": "1:1334004294809772177",
62 "name": "id",
63 "type": 6,
64 "flags": 1
65 },
66 {
67 "id": "2:8500254104736767378",
68 "name": "firstName",
69 "type": 9
70 },
71 {
72 "id": "3:1261795948739215169",
73 "name": "lastName",
74 "type": 9
75 },
76 {
77 "id": "4:8863096110280655355",
78 "name": "phone",
79 "type": 9
80 },
81 {
82 "id": "5:3077441054734333760",
83 "name": "email",
84 "type": 9
85 }
86 ],
87 "relations": []
88 },
89 {
90 "id": "4:720703670162855056",
91 "lastPropertyId": "4:5690325342466026680",
92 "name": "Invoice",
93 "flags": 2,
94 "properties": [
95 {
96 "id": "1:1570181203114245602",
97 "name": "id",
98 "type": 6,
99 "flags": 1
100 },
101 {
102 "id": "2:4307795986019697116",
103 "name": "date",
104 "type": 10
105 },
106 {
107 "id": "3:5403205385433436440",
108 "name": "total",
109 "type": 8,
110 "flags": 4
111 },
112 {
113 "id": "4:5690325342466026680",
114 "name": "customerId",
115 "indexId": "2:8233264265765179610",
116 "type": 11,
117 "flags": 1548,
118 "relationTarget": "Customer"
119 }
120 ],
121 "relations": []
122 },
123 {
124 "id": "5:2124535126347251014",
125 "lastPropertyId": "5:600965215010068015",
126 "name": "InvoiceItem",
127 "flags": 2,
128 "properties": [
129 {
130 "id": "1:3893797232755033190",
131 "name": "id",
132 "type": 6,
133 "flags": 1
134 },
135 {
136 "id": "2:3484774170370690529",
137 "name": "unitPrice",
138 "type": 8,
139 "flags": 4
140 },
141 {
142 "id": "3:5271985023292199596",
143 "name": "quantity",
144 "type": 5,
145 "flags": 4
146 },
147 {
148 "id": "4:7557084807279778428",
149 "name": "invoiceId",
150 "indexId": "3:1116397924317199080",
151 "type": 11,
152 "flags": 1548,
153 "relationTarget": "Invoice"
154 },
155 {
156 "id": "5:600965215010068015",
157 "name": "trackId",
158 "indexId": "4:1677643892085601951",
159 "type": 11,
160 "flags": 1548,
161 "relationTarget": "Track"
162 }
163 ],
164 "relations": []
165 },
166 {
167 "id": "6:828952092407258806",
168 "lastPropertyId": "5:8273078892571453738",
169 "name": "Track",
170 "flags": 2,
171 "properties": [
172 {
173 "id": "1:4902677122121855061",
174 "name": "id",
175 "type": 6,
176 "flags": 1
177 },
178 {
179 "id": "2:1219132270817494543",
180 "name": "name",
181 "type": 9
182 },
183 {
184 "id": "3:3607878157603664853",
185 "name": "unitPrice",
186 "type": 8,
187 "flags": 4
188 },
189 {
190 "id": "4:2322328496342192994",
191 "name": "stock",
192 "type": 5,
193 "flags": 4
194 },
195 {
196 "id": "5:8273078892571453738",
197 "name": "albumId",
198 "indexId": "5:1459310406895714984",
199 "type": 11,
200 "flags": 1548,
201 "relationTarget": "Album"
202 }
203 ],
204 "relations": []
205 }
206 ],
207 "lastEntityId": "6:828952092407258806",
208 "lastIndexId": "5:1459310406895714984",
209 "lastRelationId": "0:0",
210 "lastSequenceId": "0:0",
211 "modelVersion": 5,
212 "modelVersionParserMinimum": 5,
213 "retiredEntityUids": [],
214 "retiredIndexUids": [],
215 "retiredPropertyUids": [],
216 "retiredRelationUids": [],
217 "version": 1
218}
219@Sync
220@Entity
221public class Album {
222 @Id
223 public long id;
224 public String title;
225 //public long artistId;
226 public ToOne<Artist> artist;
227 @Backlink(to = "album")
228 public ToMany<Track> tracks;
229
230 public Album(){}
231
232 public Album(long id, String title, long artistId){
233 this.id = id;
234 this.title = title;
235 this.artist.setTargetId(artistId);
236 }
237}
238@Sync
239@Entity
240public class Artist {
241 @Id
242 public long id;
243 public String name;
244 @Backlink(to = "artist")
245 public ToMany<Album> albums;
246
247 public Artist(){}
248
249 public Artist(long id, String name){
250 this.id = id;
251 this.name = name;
252 }
253}
254buildscript {
255 ext.objectboxVersion = '2.9.2-RC4'
256 repositories {
257 google()
258 //jcenter()
259 mavenCentral()
260 }
261 dependencies {
262 classpath "com.android.tools.build:gradle:4.1.2"
263 classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
264 // NOTE: Do not place your application dependencies here; they belong
265 // in the individual module build.gradle files
266 }
267}
268
269allprojects {
270 repositories {
271 google()
272 //jcenter()
273 mavenCentral()
274 }
275}
276
277task clean(type: Delete) {
278 delete rootProject.buildDir
279}
280plugins {
281 id 'com.android.application'
282 id 'io.objectbox.sync'
283}
284
285android {
286 compileSdkVersion 30
287 buildToolsVersion "30.0.3"
288
289 defaultConfig {
290 applicationId "com.example.mediastore"
291 minSdkVersion 21
292 targetSdkVersion 30
293 versionCode 1
294 versionName "1.0"
295
296 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
297 }
298
299 buildTypes {
300 release {
301 minifyEnabled false
302 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
303 }
304 }
305 compileOptions {
306 sourceCompatibility JavaVersion.VERSION_1_8
307 targetCompatibility JavaVersion.VERSION_1_8
308 }
309}
310
311dependencies {
312
313 implementation 'androidx.appcompat:appcompat:1.2.0'
314 implementation 'com.google.android.material:material:1.3.0'
315 implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
316 testImplementation 'junit:junit:4.+'
317 implementation "io.objectbox:objectbox-sync-android:$objectboxVersion"
318 androidTestImplementation 'androidx.test.ext:junit:1.1.2'
319 androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
320}
321
ANSWER
Answered 2021-Sep-27 at 06:13Use at least ObjectBox for Java version 2.9.2-RC4 which removes some flags that are incompatible with Sync from the model JSON file.
QUESTION
Can't create a fresh Nuxt project?
Asked 2021-Aug-13 at 23:14I tried to create a fresh Nuxt.js project with the below command. Everything has worked fine previously except today.
The process as well as the output are all described below.
Anyone could help me to investigate this ?
1begueradj@FA512:~$ yarn create nuxt-app client
2yarn create v1.22.5
3[1/4] Resolving packages...
4[2/4] Fetching packages...
5[3/4] Linking dependencies...
6[4/4] Building fresh packages...
7
8success Installed "create-nuxt-app@3.7.1" with binaries:
9 - create-nuxt-app
10
11create-nuxt-app v3.7.1
12✨ Generating Nuxt.js project in client
13? Project name: client
14? Programming language: JavaScript
15? Package manager: Yarn
16? UI framework: Vuetify.js
17? Nuxt.js modules: Axios - Promise based HTTP client
18? Linting tools: ESLint
19? Testing framework: Jest
20? Rendering mode: Universal (SSR / SSG)
21? Deployment target: Server (Node.js hosting)
22? Development tools: jsconfig.json (Recommended for VS Code if you're not using typescript)
23? Continuous integration: None
24? Version control system: Git
25warning nuxt > @nuxt/babel-preset-app > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the
26 number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even i
27f nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
28warning nuxt > @nuxt/webpack > webpack-hot-middleware > querystring@0.2.1: The querystring API is considered Legacy. new code should
29use the URLSearchParams API instead.
30warning nuxt > @nuxt/webpack > webpack > node-libs-browser > url > querystring@0.2.0: The querystring API is considered Legacy. new c
31ode should use the URLSearchParams API instead.
32warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrad
33e to chokidar 3 with 15x less dependencies.
34warning nuxt > @nuxt/webpack > webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: fsevents 1 will break on node
35v14+ and could be using insecure binaries. Upgrade to fsevents 2.
36warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lyd
37ell/urix#deprecated
38warning nuxt > @nuxt/webpack > webpack > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/
39resolve-url#deprecated
40warning vue-jest > extract-from-css > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
41warning vue-jest > babel-plugin-transform-es2015-modules-commonjs > babel-runtime > core-js@2.6.12: core-js@<3.3 is no longer maintai
42ned and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versi
43ons could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-
44js.
45error babel-jest@27.0.6: The engine "node" is incompatible with this module. Expected version "^10.13.0 || ^12.13.0 || ^14.15.0 || >=
4615.0.0". Got "14.4.0"
47error Found incompatible module.
48
49yarn install v1.22.5
50info No lockfile found.
51[1/4] Resolving packages...
52[2/4] Fetching packages...
53info fsevents@2.3.2: The platform "linux" is incompatible with this module.
54info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
55info fsevents@1.2.13: The platform "linux" is incompatible with this module.
56info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
57info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
58
59/home/begueradj/.config/yarn/global/node_modules/sao/lib/installPackages.js:108
60 throw new SAOError(`Failed to install ${packageName} in ${cwd}`)
61 ^
62
63SAOError: Failed to install packages in /home/begueradj/client
64 at ChildProcess.<anonymous> (/home/begueradj/.config/yarn/global/node_modules/sao/lib/installPackages.js:108:15)
65 at ChildProcess.emit (events.js:315:20)
66 at maybeClose (internal/child_process.js:1051:16)
67 at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
68 __sao: true
69}
70error Command failed.
71Exit code: 1
72Command: /home/begueradj/.yarn/bin/create-nuxt-app
73Arguments: client
74Directory: /home/begueradj
75Output:
76
77info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
78
ANSWER
Answered 2021-Aug-13 at 22:16npx create-nuxt-app <my-project>
is still the fastest and easiest way to get a brand new Nuxt project. Not sure if you'll get the Node issue with it.
For more details, check this one: https://github.com/nuxt/create-nuxt-app
QUESTION
Why does the Version Control System Git stage files first, instead of committing them directly?
Asked 2021-Aug-12 at 10:03Why does the Version Control System Git stage files first, instead of committing them directly? I mean why we can't just commit files directly instead of staging them firstly then commit them?
ANSWER
Answered 2021-Aug-12 at 09:58Instead of committing all of the changes you've made since the last commit, the stage lets you group related changes into highly focused snapshots before actually committing it to the project history. This means you can make all sorts of edits to unrelated files, then go back and split them up into logical commits by adding related changes to the stage and commit them piece-by-piece. As in any revision control system, it’s important to create atomic commits so that it’s easy to track down bugs and revert changes with minimal impact on the rest of the project.
Ref : https://www.atlassian.com/git/tutorials/saving-changes
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Version Control System
Tutorials and Learning Resources are not available at this moment for Version Control System