Github in Parent Directory of Google Colab - google-colaboratory

I'm a noob to Google Colab and Python. I'm attempting to import a custom set of scripts from a Github directory. I'm using the following:
!git clone https://github.com/theAIGuysCode/tensorflow-yolov4-tflite.git
By default, this will export to a folder that it names based on the git name. However, the functions in the needed scripts call the parent directory and not the git folder name. Example:
Google Colab Screenshot
Is there a method for importing the git in the parent directory so the scripts can run without modifying the file hierarchy in each script?

The error is that you are in a different directory. Most likely current directory is /content/ if those two cells in the picture are on top.
You need to change directory before you can call save_model.py, then it will work as expected. Use !pwd to know the current directory.
Before the last cell change directory to the one where desired code is. So in this case it can be,
%cd "/content/tensorflow-yolov4-tflite"
If you are unsure about path, right click on folder and select Copy path to use with cd command.

Related

How do I change path directory in Jupyter lab?

How do I change initial path directory in Jupyter lab, when i want to get a file via "~/"?
Have tried to generate config, and then change some parameters but only got confused.
You can change file directory like that.
import shutil
File= r'C:\Users\ivan\Desktop\Somewhereidonotknow\example.csv'
Whereyou_want= r'C:\Users\ivan\Desktop\example.csv'
shutil.move(File, Whereyou_want)
You should be using the %cd magic command to change the working directory. And then to set up using tab completion, you'd start by typing ./ before hitting tab at the place where you want to choose your CSV file.
In the demonstration set-up for the screenshot below I made a test directory in the root (home) location and made two CSV files in there.
Using %cd test first I am then able to use tab completion to get the option to select one of the two CSV files:
I probably should have included running pwd to 'print the working directoryafter I ran the%cd test` command to demonstrate things more fully.
Before I executed the command %cd test, the tab-completion was showing the root (home directory) when I tried for tab completion.
The tilde symbol (~) always means the HOME directory on the system. It won't change. So you were always specifying to start in HOME in your example in your post, no matter what the current working directory is in the notebook's active namespace. You want to use relative paths for when the working directory has been adjusted.
There are more complex settings you can take advantage of using inside the notebook in conjunction with the %cd magic.
For example, this post and answer shows how you can use the %boookmark magic to set assign a directory to a bookmark setting and then you can more easily switch around to various directories using %cd.

Cant create new directory inside existing directory in IntelliJ

Im using IntelliJ community version for Spring project, and I have issue with creating new directory named images inside already existing directory resources -> static. When I right click on static and I add new directory images, instead of creating new directory this is created.
Someone could say that it is ok, this is a way new directory is shown, but I dont think that is correct. When I try to remove images directory I can remove only both directories static.images directory. If I try to add new directory into static directory, it goes into static.images and not into static.
So question is how to create directory inside another directory? There is no issue when I add new package inside another package in the src->main->java project structure.
The other person is correct. The directory was created as you desired, it is just displayed differently that you expected.
To verify this, open a shell and list the directories. The following shows all the directories under the current directory.
$ find . -type d
The directory parent is based on where in the path you click. If you click on the word static you will create a directory under the static directory. If you click on the word images you will create a directory under the images directory.

How do I specify JRE when creating a Bamboo sidekick agent for their per-build-container plug-in?

Trying to get the sidekick image built and having some issues. Is there any documentation other than the README.md file?
My current problem is with getting the JRE requirement working but there are others. The page says "download Oracle JRE and place it inside the working directory. Optionally if you have a company wide distribution url, use that one at a later step." and the help says "Java (JRE) download url or path inside working directory". Have not been able to get this to work.
I went to the JRE link provided and was presented with options to download a rpm file or a tar.gz file. Which is expected (was unable to get either one working)?
It says to place the file in the "working directory" but not sure where exactly. Tried in sidekick folder and in sidekick/jre both without success no matter what I used after the -j command. Is this just the path or should the filename be included as well? Can I get an example?
I'm running this script using my login but noticed the output folder is being created with root user and group. I see no indication that this should be run with sudo. What is the correct way to run this script?
Using debug, I see the function "download if not cached". Can I save these files (JRE, Bamboo jar file, etc.) somewhere so I don't have to worry about downloading them? If so, where should they go? Looks like I might have a problem with the wget to d/l the jar file so would like to just be able to place all these in a folder and be done with it.
It looks like the major problem is the script didn't clean up after itself if it fails. The issue was the first time it failed then that caused subsequent issues as the output folder was already there. Removing this directory between each attempt help.
As for the correct syntax for the -j JRE option I manually downloaded the JRE and placed in a folder called per-build-container/sidekick/stuff/. For the command line it is not just the path but the file name as well (the tar.gz and not the RPM). For my case it was
-j stuff/jre-8u251-linux-x64.tar.gz
Note I also ran the script as sudo. Wasn't stated but seemed to work OK.
Another issue I ran into was the download of the agent jar file. There is a redirect in the wget file that was not working for us. I ended up editing the script and replacing the Altassian based url with the redirected one.
This addresses all the issues I ran into with the initial question.

Is there a way to have a file path in T-sql and PostgreSQL that stays within the project directory?

I am importing data from a CSV file using the COPY FROM in PostgreSQL. It works flawlessly on my machine, however, were I to clone the repository onto a new machine the code would cease to function to the file path being hardcoded starting at the Users directory of the computer.
In other languages, I would be able to use something like ./ or ~/ to start somewhere not at the absolute beginning of the file, but I haven't found T-SQL or Postgres to have that functionality available.
What I have
COPY persons(name,address,email,phone)
FROM '/Users/admin/Development/practice/data/persons.csv
How can I make that file path function on any machine the project gets cloned to?

How to pass dataset directory in google datalab

I have setup google datalab on my local machine then tried to read dataset using pandas by passing custom data directory but it doesn't take path correctly it adds root at the start then try to pass absolute path then it gives error file doesn't exist but file is in the directory.
Can any one help me what is the issue or anyone explain me is there any predefined rule to put the dataset
If you ran Datalab as a docker container on your local machine, it automatically maps your home directory to /content inside the container, so just make sure your Dataset is accessible from your home path.