How to include a library in the path while compiling? - compilation

I'm reading this post about go and was trying to compile the source code found here
I downloaded the source code, compiled the first file with make and I can see the object is generated:
$pwd
/Users/oscarryz/code/go/rsc/rosetta/graph
$ls -ltR
total 136
-rw-r--r-- 1 oscarryz staff 61295 Sep 17 16:20 _go_.6
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 _obj
-rw-r--r-- 1 oscarryz staff 126 Sep 17 16:17 Makefile
-rw-r--r-- 1 oscarryz staff 2791 Sep 17 16:17 graph.go
./_obj:
total 0
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 rsc.googlecode.com
./_obj/rsc.googlecode.com:
total 0
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 hg
./_obj/rsc.googlecode.com/hg:
total 0
drwxr-xr-x 3 oscarryz staff 102 Sep 17 16:20 rosetta
./_obj/rsc.googlecode.com/hg/rosetta:
total 136
-rw-r--r-- 1 oscarryz staff 68486 Sep 17 16:20 graph.a
No my question is, how do I refer to that compiled code from the maze directory:
/Users/oscarryz/code/go/rsc/rosetta/maze/maze.go
Whose import declarations are:
import (
"bytes"
"fmt"
"rand"
"time"
"rsc.googlecode.com/hg/rosetta/graph"
)
And right now is failing to compile with the error message:
6g -o _go_.6 maze.go
maze.go:20: can't find import: rsc.googlecode.com/hg/rosetta/graph
make: *** [_go_.6] Error 1

Ok, I found it, wasn't that hard.
6g flags: -I DIR search for packages in DIR
I have to specify the -I option like this:
6g -I ../graph/_obj/ -o _go_.6 maze.go

Related

Is there a way to remove the owner's read permissions on a file in macOS?

Is there any way to take away the owner's permission to read a file in macOS? I know there's no reason to do this but I have to for school and I can't find an answer anywhere. Removing my write permission works fine but when I try to remove my read permission it automatically give me my read and write permissions back. As you can see in the console when I use chmod -v -v (extra verbose) it shows the correct permissions it should be changed to but then when checking afterwards they havent changed into that...
thijs#Thijss-MacBook-Air-2 week6 % ls -l
total 16
-rw----r-- 1 thijs staff 12 Oct 11 21:10 greeting.txt
-rw-r--r-- 1 thijs staff 0 Oct 11 21:10 hello.txt
-rw------- 1 thijs staff 15 Oct 11 21:11 weather.txt
thijs#Thijss-MacBook-Air-2 week6 % chmod -v -v u-w weather.txt
weather.txt: 0100600 [-rw------- ] -> 0100400 [-r-------- ]
thijs#Thijss-MacBook-Air-2 week6 % ls -l
total 16
-rw----r-- 1 thijs staff 12 Oct 11 21:10 greeting.txt
-rw-r--r-- 1 thijs staff 0 Oct 11 21:10 hello.txt
-r-------- 1 thijs staff 15 Oct 11 21:11 weather.txt
thijs#Thijss-MacBook-Air-2 week6 % chmod -v -v u-r weather.txt
weather.txt: 0100400 [-r-------- ] -> 0100000 [---------- ]
thijs#Thijss-MacBook-Air-2 week6 % ls -l
total 16
-rw----r-- 1 thijs staff 12 Oct 11 21:10 greeting.txt
-rw-r--r-- 1 thijs staff 0 Oct 11 21:10 hello.txt
-rw------- 1 thijs staff 15 Oct 11 21:11 weather.txt

Class org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem not found when using -addMount in HDFS

I have the following setup:
$ export |grep HADOOP
declare -x HADOOP_HOME="/home/jesaremi/hadoop-3.1.3-bin"
declare -x HADOOP_OPTIONAL_TOOLS="hadoop-azure"
$ echo $PATH
/home/jesaremi/hadoop-3.1.3-bin/bin:/home/jesaremi/hadoop-3.1.3-bin/sbin:/opt/protobuf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jesaremi/.dotnet/tools:/opt/HP_Fortify/HP_Fortify_SCA_and_Apps_4.30/bin:/opt/HP_Fortify/HP_Fortify_SCA_and_Apps_4.30/bin
$ ls -l /home/jesaremi/hadoop-3.1.3-bin/share/hadoop/common/
total 7452
-rw-rw-r-- 1 jesaremi jesaremi 303043 Dec 19 17:30 hadoop-azure-3.1.3.jar
-rw-rw-r-- 1 jesaremi jesaremi 4092533 Dec 17 09:42 hadoop-common-3.1.3-SNAPSHOT.jar
-rw-rw-r-- 1 jesaremi jesaremi 2877294 Dec 17 09:42 hadoop-common-3.1.3-SNAPSHOT-tests.jar
-rw-rw-r-- 1 jesaremi jesaremi 130001 Dec 17 09:42 hadoop-kms-3.1.3-SNAPSHOT.jar
-rw-rw-r-- 1 jesaremi jesaremi 201637 Dec 17 09:42 hadoop-nfs-3.1.3-SNAPSHOT.jar
drwxrwxr-x 2 jesaremi jesaremi 4096 Dec 17 09:42 jdiff
drwxrwxr-x 2 jesaremi jesaremi 4096 Dec 17 09:42 lib
drwxrwxr-x 2 jesaremi jesaremi 4096 Dec 17 09:42 sources
drwxrwxr-x 3 jesaremi jesaremi 4096 Dec 17 09:42 webapps
Yet when I try to amount an ABFS file system I get this:
$ hdfs dfsadmin -addMount abfs://main#test1.dfs.core.windows.net/ /mnt/abfs/main "fs.azure.abfs.account.name=test1.dfs.core.windows.net,fs.azure.account.key.test1.dfs.core.windows.net=<key removed>"
addMount: java.lang.ClassNotFoundException: Class org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem not found
afraid that HADOOP_OPTIONAL_TOOLS env var isn't enough; you'll need to get hadoop-azure JAR and some others into common/lib
from share/hadoop/tools/lib copy hadoop-azure jar, azure-* and, if it's there, wildfly-openssl.jar into share/hadoop/common/lib
The cloudstore JAR is with diagnostics as it tells you which JAR is missing, e.g.
bin/hadoop jar cloudstore-0.1-SNAPSHOT.jar storediag abfs://c#account.dfs.core.windows.net/

Make nl to enumerate from a specified line

I intent to enumerate the files and dirs
[root#iz2ze9wve43n2nyuvmsfx5z /]# ls -lh |nl
1 total 60K
2 lrwxrwxrwx 1 root root 7 Jun 15 22:08 bin -> usr/bin
3 dr-xr-xr-x. 5 root root 4.0K Jun 15 22:10 boot
4 drwxr-xr-x 19 root root 2.9K Sep 17 11:35 dev
5 drwxr-xr-x. 85 root root 4.0K Sep 18 22:44 etc
6 drwxr-xr-x. 2 root root 4.0K Sep 17 08:25 home
7 lrwxrwxrwx 1 root root 7 Jun 15 22:08 lib -> usr/lib
8 lrwxrwxrwx 1 root root 9 Jun 15 22:08 lib64 -> usr/lib64
9 drwx------. 2 root root 16K Oct 15 2017 lost+found
10 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 media
11 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 mnt
12 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 opt
13 dr-xr-xr-x 86 root root 0 Sep 17 11:35 proc
14 drwxrwxrwx. 21 root root 4.0K Oct 22 08:11 root
15 drwxr-xr-x 24 root root 660 Oct 24 19:10 run
16 lrwxrwxrwx 1 root root 8 Jun 15 22:08 sbin -> usr/sbin
17 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 srv
18 dr-xr-xr-x 13 root root 0 Oct 21 19:50 sys
19 drwxrwxrwt. 11 root root 4.0K Oct 24 05:19 tmp
20 drwxr-xr-x. 13 root root 4.0K Jun 15 22:08 usr
21 drwxr-xr-x. 19 root root 4.0K Jun 15 22:08 var
It starts with 1 which I desire is 0.
How could make nl to enumerate from a specified line.
You just need to use the -v option, and specify to start from 0; your instruction becoming:
ls -lh |nl -v 0
Lets have a look at nl --help:
$ nl --help
Usage: nl [OPTION]... [FILE]...
Write each FILE to standard output, with line numbers added.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
...
-v, --starting-line-number=NUMBER first line number for each section
Therefore:
$ nl -v0 <<EOF
> a
> b
> EOF
0 a
1 b
Note that it does not really matter whether you want to enumerate directories or anything else, which is why you probably should strip this part from your question to make it more specific.

Sorting ls output by file size

I am currently sorting the output of ls -l by byte count using:
ls -l | sort -r -k5,5 -n
What if I wanted to make this work with the -# flag? Currently this will output:
-rwxr-xr-x# 1 name staff 7106 2 May 10:43 c
-rwxr-xr-x 1 name staff 675 22 Apr 17:57 a
-rwxr-xr-x 1 name staff 486 23 Apr 07:56 b
drwxr-xr-x 4 name staff 136 25 Apr 18:38 d
-rwxr-xr-x 1 name staff 120 23 Apr 07:59 e
-rwxr-xr-x 1 name staff 112 22 Apr 18:45 g
-rwxr-xr-x 1 name staff 51 22 Apr 18:45 f
total 56
com.apple.metadata:_kMDItemUserTags 42
Where I want it to take the extended attribute keys line and keep it below the appropriate file like so:
-rwxr-xr-x# 1 name staff 7106 2 May 10:43 c
com.apple.metadata:_kMDItemUserTags 42
-rwxr-xr-x 1 name staff 675 22 Apr 17:57 a
-rwxr-xr-x 1 name staff 486 23 Apr 07:56 b
drwxr-xr-x 4 name staff 136 25 Apr 18:38 d
-rwxr-xr-x 1 name staff 120 23 Apr 07:59 e
-rwxr-xr-x 1 name staff 112 22 Apr 18:45 g
-rwxr-xr-x 1 name staff 51 22 Apr 18:45 f
total 56
No need to use sort, just use the -S option with ls
ls -Sl
(that's an upper case S)

Symfony2 : can't duplicate site because of strange folders architecture

I have to retrieve an existing symfony2 (2.1.13) project from prod server in order to run it locally to make some changes. The problem is the architecture seems to be a little bit strange. Please have a look on it :
$pwd
/var/www/html/sites/www.mysite.com
drwxr-xr-x 2 ... 4.0K Jun 30 09:30 backups/
drwxr-x--- 2 ... 6 Mar 15 2013 cgi-bin/
drwxr-xr-x 4 ... 41 Aug 10 18:09 _copie1/
drwxr-xr-x 2 ... 6 Apr 25 2014 log/
drwxr-xr-x 12 ... 4.0K Aug 11 15:41 releases/
drwxr-xr-x 7 ... 146 May 12 16:46 repo/
drwxr-xr-x 5 ... 85 May 12 16:49 shared/
lrwxrwxrwx 1 ... 58 Jul 6 15:11 current -> /var/www/html/sites/www.mysite.com/releases/201508/
lrwxrwxrwx 1 ... 12 Mar 28 2013 html -> current/web//
-rw-r--r-- 1 ... 1022 Jul 6 15:11 revisions.log
current/
drwxr-xr-x 6 ... 4.0K Jul 6 15:09 app/
drwxr-xr-x 2 ... 124 Jul 6 15:05 bin/
drwxr-xr-x 4 ... 50 Aug 11 14:54 src/
drwxr-xr-x 35 ... 4.0K Aug 11 12:08 vendor/
drwxr-xr-x 5 ... 4.0K Aug 11 18:28 web/
-rw-r--r-- 1 ... 626 Jul 6 15:05 Capfile
-rw-r--r-- 1 ... 4.1K Jul 6 15:05 composer.json
-rw-r--r-- 1 ... 167K Jul 6 15:05 composer.lock
-rw-r--r-- 1 ... 216 Jul 6 15:05 Gemfile
-rw-r--r-- 1 ... 1.2K Jul 6 15:05 Gemfile.lock
-rw-r--r-- 1 ... 1.1K Jul 6 15:05 LICENSE
-rw-r--r-- 1 ... 1.6K Jul 6 15:05 README.md
-rw-r--r-- 1 ... 8 Jul 6 15:06 REVISION
-rw-r--r-- 1 ... 7.7K Jul 6 15:05 UPGRADE.md
-rw-r--r-- 1 ... 7 Jul 6 15:05 VERSION
current/web/
drwxr-xr-x 2 ... 4.0K Aug 11 12:10 bundles/
drwxr-xr-x 4 ... 4.0K Jul 6 15:11 compiled/
drwxr-xr-x 2 ... 47 Jul 6 15:11 js/
-rw-r--r-- 1 ... 46K Jul 6 15:11 apc.php
-rw-r--r-- 1 ... 11K Jul 6 15:05 apple-touch-icon.png
-rw-r--r-- 1 ... 7.0K Jul 6 15:05 apple-touch-icon-precomposed.png
-rw-r--r-- 1 ... 728 Jul 6 15:05 app.php
-rw-r--r-- 1 ... 33K Jul 6 15:05 favicon.ico
-rw-r--r-- 1 ... 20K Jul 6 15:05 favicon.jpg
-rw-r--r-- 1 ... 4.6K Jul 6 15:05 favicon.png
lrwxrwxrwx 1 ... 51 Jul 6 15:06 image -> /var/www/html/sites/www.mysite.com/shared/web/image/
lrwxrwxrwx 1 ... 52 Jul 6 15:06 medias -> /var/www/html/sites/www.mysite.com/shared/web/medias/
-rw-r--r-- 1 ... 66 Aug 10 12:28 robots.txt
-rw-r--r-- 1 ... 2.2M Aug 11 03:00 sitemap.xml
current/web/bundles/
lrwxrwxrwx 1 ... 147 Jul 6 15:09 bazingaexposetranslation -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/willdurand/js-translation-bundle/Bazinga/ExposeTranslationBundle/Resources/public/
lrwxrwxrwx 1 ... 121 Jul 6 15:09 ericharddms -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/erichard/dms-bundle/Erichard/DmsBundle/Resources/public/
lrwxrwxrwx 1 ... 126 Jul 6 15:09 farosadmin -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/faros/admin-bundle-legacy/Faros/AdminBundle/Resources/public/
lrwxrwxrwx 1 ... 125 Jul 6 15:09 faroselfinder -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/faros/elfinder-bundle/Faros/ElFinderBundle/Resources/public/
lrwxrwxrwx 1 ... 113 Jul 6 15:09 farosqb -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/faros/qb-bundle/Faros/QBBundle/Resources/public/
lrwxrwxrwx 1 ... 116 Jul 6 15:09 fosjsrouting -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/friendsofsymfony/jsrouting-bundle/Resources/public/
lrwxrwxrwx 1 ... 133 Jul 6 15:09 framework -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/
lrwxrwxrwx 1 ... 132 Jul 6 15:09 mopabootstrap -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/mopa/bootstrap-bundle/Mopa/Bundle/BootstrapBundle/Resources/public/
lrwxrwxrwx 1 ... 129 Jul 6 15:09 trsteelckeditor -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/trsteel/ckeditor-bundle/Trsteel/CkeditorBundle/Resources/public/
lrwxrwxrwx 1 ... 99 Jul 6 15:09 mysiteadmin -> /var/www/html/sites/www.mysite.com/releases/201508/src/mysite/AdminBundle/Resources/public/
lrwxrwxrwx 1 ... 98 Jul 6 15:09 mysitesite -> /var/www/html/sites/www.mysite.com/releases/201508/src/mysite/SiteBundle/Resources/public/
current/app/
drwxr-xr-x 4 ... 27 Aug 11 18:32 cache/
drwxr-xr-x 3 ... 4.0K Aug 11 12:12 config/
drwxr-xr-x 2 ... 4.0K Jul 6 15:05 DoctrineMigrations/
drwxr-xr-x 8 ... 105 Jul 6 15:06 Resources/
-rw-r--r-- 1 ... 141 Jul 6 15:05 AppCache.php
-rw-r--r-- 1 ... 4.3K Jul 6 15:05 AppKernel.php
-rw-r--r-- 1 ... 474 Jul 6 15:05 autoload.php
-rw-r--r-- 1 ... 48K Jul 6 15:09 bootstrap.php.cache
-rw-r--r-- 1 ... 1.7K Jul 6 15:09 check.php
-rwxr-xr-x 1 ... 794 Jul 6 15:05 console*
lrwxrwxrwx 1 ... 50 Jul 6 15:06 logs -> /var/www/html/sites/www.mysite.com/shared/app/logs/
-rw-r--r-- 1 ... 1.7K Jul 6 15:05 phpunit.xml.dist
-rw-r--r-- 1 ... 26K Jul 6 15:09 SymfonyRequirements.php
lrwxrwxrwx 1 ... 49 Jul 6 15:06 var -> /var/www/html/sites/www.mysite.com/shared/app/var/
As you can see there are so many symlinks :(
I have a new installation of symfony 2.1.13 on my wamp server, so :
1. What should I exactly copy from the server ?
2. And where to copy ?
3. How to configure files like AppKernel.php, config.php, parameters.yml ...
Thanks :)
Looks like you are stepped to the task from apposite side
First of all "strange" folders architecture is comming from the nature of the deployment tool "capifony". You can see folder "releases" that keeps all history of releases deployed and folder(symlink) "current" that points to the latest(current) release. Also you can see some symlinks to the folder "shared" that suppose to keep some content that doesn't suppose change from deploy to deploy (like images, logs).
It is possible to explain long how capifony works, but seems it is better to get some quick overview http://capifony.org/
In short words I can say that you can copy the site to local, but it is not the best way. I suppose you need to clone the project from its repository(most probably git) and setup parameters.yml
You should not change AppKernel.php or config.php
Clone the respository and looks for app/config/parameters.yml.dist that will(should) have initial configuration for the project
PS: you should not copy "current/web/bundles/" but should use "assets install" command to create these assets
PPS: And I believe you should to learn some symfony docs(at least basic) before start to copy the site

Resources