Any help to write command lines on the Terminal (mac - Qt) - qt

can you help me a little bit with the Terminal?
i would like to use these command lines :
cd /path/to/Qt
./configure -static <other parameters>
make sub-src
so i open the Terminal, and write cd then i drag QtSDK and it shows me this path : /Developer/Applications/Qt
EDIT :
so i guess the 3 lines must be copied one after the other...
i wrote those lines in a row, but this time i've got no error message, nor any responses if i try to write "-help" just after ./configure , as if it wasn't working. I'm following this tutorial from the doc : http://doc.qt.io/qt-5/osx-deployment.html
Any idea?

Im not sure what youre trying to do. Write a script to do it for you. her is a little bit of help.
if you type
pwd
it will return your current location. This way you can find out where you are.
Users/Paul/QtSDK
if the above is your goal,
pwd
should return
/Users/Paul
This means, to Change directory (cd), all you have to do is
cd QtSDK
This is assuming QtSDK is located in your user folder.
you can do
ls
to find out.
The following is the output of my ls in my home directory or "/Users/cy/
#:~ cy$ pwd
/Users/cy
#:~ cy$ ls
Desktop Downloads Movies Pictures Sites
Documents Library Music Public
You should also see your QtSDK folder there.
To restart your location, go back to where it should begin. Type:
cd
with nothing else.
this will put you back to your home folder..
Last but not least,
<Other Prams>
should be replace with the actual prams and not to be left as you have shown in your code
PS:Capitalization is important

Related

How to fix "warning: could not open directory" after "git add ." command on Mac OS X Maverick

I'm new to R and RStudio and am currently taking online classes to learn more about data science. In one of my lectures, I'm being asked to create a project in RStudio prior to creating a repository in github and linking the project with git. In order to make a pre-existing project interact with git, the instructions in my lecture are telling me to navigate to the directory containing my project file by using the "cd" command followed by the location of the file and file name. My project file is currently located on my desktop so I typed in "cd ~ /Desktop/temporary_no_version_control" however, the directory doesn't seem to change and remains set on the original location of the file which was in Users/savannahkeiffer. Just so I could complete the assignment, I re-located the file to my user file and tried to follow the rest of the instructions which told me to type "git init" followed by "git add ." which is where I run into the "warning: could not open directory" warning.
I have a macbook which runs on OS X Maverick. I went into my system preferences > security and privacy and selected Full Disk Access where I manually allowed terminal to have access to all the files on my laptop. However, after closing and re-opening RStudio and attempting the commands again, I got the same error.
This is what I entered when I tried to change the directory
Savannahs-MacBook-Air-2:~ savannahkeiffer$ cd ~
/Desktop/temporary_no_version_control
Savannahs-MacBook-Air-2:~ savannahkeiffer$ git init
Reinitialized existing Git repository in
/Users/savannahkeiffer/.git/
And what I got when I changed the location of the project on my laptop in order to complete the assignment (after already giving access to terminal)
Savannahs-MacBook-Air-2:~ savannahkeiffer$ cd ~
/Users/savannahkeiffer/first project/temporary_no_version_control
Savannahs-MacBook-Air-2:~ savannahkeiffer$ git init
Reinitialized existing Git repository in
/Users/savannahkeiffer/.git/
Savannahs-MacBook-Air-2:~ savannahkeiffer$ git add .
warning: could not open directory 'Pictures/Photos
Library.photoslibrary/': Operation not permitted
warning: could not open directory 'Library/Application
Support/MobileSync/': Operation not permitted
warning: could not open directory 'Library/Application
Support/CallHistoryTransactions/': Operation not permitted
warning: could not open directory 'Library/Application
Support/com.apple.TCC/': Operation not permitted
warning: could not open directory 'Library/Application
Support/AddressBook/': Operation not permitted
And so on.. Is this a directory problem or a "git add ." command problem?
It looks like what happened is that when you typed the cd command, you left a space in between the tilde and the rest of the path, so you changed back into your home directory (represented by the tilde). Then, when you tried to do a git init, you tried to initialize your home directory as a Git repository, and then ran into the fact that macOS restricts some programs (in your case, not Terminal, but maybe still Git) from accessing certain directories.
In the shell, the tilde is just a fancy way of spelling the environment variable $HOME, which points to your home directory (in this case, /Users/savannahkeiffer), so it should immediately precede the rest of the path without a space in between.
The best thing to do in this case is switch into your project directory and then initialize a repository there:
cd ~/Desktop/temporary_no_version_control # note the lack of space after the tilde
git init
If you didn't intend for your home directory to be a repository (i.e., you're not storing your dotfiles in a repository there), then you will probably also want to remove the .git directory from your home directory by running rm -fr ~/.git. Be careful when typing this, as rm removes data without prompting and an unfortunate space could result in all your data being deleted.
Hello this was an issue I had also but in Windows. It was a simple fix, user error. I hadn't used gitbash for awhile so I forgot the process with working in gitbash. First mistake I made was after opening gitbash I directly executed the git status command. That's when I got the "warning: could not open the directory" message. You need to using the cd (change directory) command and the dir (directory) command to navigate to the folder that has the files you want to "git add ." and "git commit -m". Once you get to that folder you will be able to use the "git status" command to see your changes then proceed as normal. I had to post this because it took me hours before I realized what I was doing wrong. No other stack post pointed this obvious user mistake. Hope it helps you.

Why changing LD_LIBRARY_PATH has no effect in Ubuntu?

I was trying to deploy my application on Ubuntu 16.04. So i made a package with the following hierarchy -
Package
|
----bin
|
-----application
-----application.sh
-----Qt
|
-----necessary qt libraries
-----platforms
Here is the application.sh file -
#!/bin/sh
export LD_LIBRARY_PATH=`pwd`/Qt
./application
When i execute the application.sh file, it shows me that it cant find the libQt5MultimediaWidgets.so.5 file. But its in the Qt folder. Also when i print the ldd application from the application.sh file after exporting LD_LIBRARY_PATH it gives me following output -
Please check the marked parts. Can anyone please explain why the libraries from the Qt folder are not found even after exporting the LD_LIBARRY_PATH?
Edit:
So as suggested by #Zang, i have checked the debug log and here it is -
Please check the marked parts.
It seems like its actually trying the actual libQt5MultimediaWidgets.so and then report that its unable to find it. Can anyone please help me understand whats happening here?
Edit-2: As per suggestion from #Tarun, i have ran ls -al on my Qt folder. Here is the output -
All files in Your Qt directory are actually simlinks to non-existing files in the same directory, therefore they cannot be found.
If you look at the output of your ls -al
These are soft links that you have. Your softlink libQt5MultimediaWidgets.so.5 points to libQt5MultimediaWidgets.so.5.9.2 in the same directory and the file is not there at all. So you need to either set the correct softlink path or have the file in same directory
First
Could it be that the pwd is not where you assume it is?
You could try adding
# Figure out where the application.sh script is located
scriptpath="$( cd "$(dirname "$0")" ; pwd -P )"
# Make sure our pwd is that location
cd "$scriptpath"
in the top of your script (assumes bash shell, from here)
By doing this all relative paths to Qt folder will be valid.
Second
Maybe you should considder exporting your new LD_LIBRARY_PATH, like so (from here):
LD_LIBRARY_PATH=whatever
export LD_LIBRARY_PATH
Third
It may be useful to run ldconfig command for ld to update after changing the variable (from here):
sudo ldconfig
The file libQt5MultimediaWidgets.so is not present in /Desktop/package/bin/Qt according to the screenshots shown.

How to recover deleted iPython Notebooks

I have iPython Notebook through Anaconda. I accidentally deleted an important notebook, and I can't seem to find it in trash (I don't think iPy Notebooks go to the trash).
Does anyone know how I can recover the notebook? I am using Mac OS X.
Thanks!
This is bit of additional info on the answer by Thuener,
I did the following to recover my deleted .ipynb file.
The cache is in ~/.cache/chromium/Default/Cache/ (I use chromium)
used grep in binary search mode, grep -a 'import math' (replace search string by a keyword specific in your code)
Edit the binary file in vim (it doesn't open in gedit)
The python ipynb should file start with '{ "cells":' and
ends with '"nbformat": 4, "nbformat_minor": 2}'
remove everything outside these start and end points
Rename the file as .ipynb, open it in your jupyter-notebook, it works.
The "delete" functionality now sends the file to OS trash rather than permanently deleting it, see this PR: https://github.com/jupyter/notebook/pull/1968. So you can just open your Trash (wherever that is on your system) and restore it.
I think the easiest way (until developers handle this issue) to retrieve your Ipython history is to write them all into an empty file.
You need to check by the date you created your last script. Obviously, it is going to be the last part of your Ipython history.
To write your Ipython history into a file:
%history -g -f anyfilename
On linux:
I did the same error and I finally found the deleted file in the trash
/home/$USER/.local/share/Trash/files
If you deleted it through the OS (rm file.ipynb) then you can probably get it from ~/.ipython_checkpoints/ However, if you deleted it from the browser menu option, it is gone (by design!).
See discussion here: https://github.com/jupyter/notebook/issues/405
If you use PyCharm, you can do the following.
Open the Local History view.
Select the version you want to roll back to.
On the context menu of the selection, choose Revert.
Worked for me!
Source: here
For the unlucky ones like me, that delete some files on JuliaBox(jupyter for julia), there is a solution. I successifly recovery all my deleted files.
The browsers strore cache information about the pages you visit. You have to find your cache browser folder (in ubuntu with crhome was ~/.cache/google-chrome/Default/Cache) and grep for some text of your notebook in the binarys. Then, cut the text part of the file that is correspond to your ipynb.
https://groups.google.com/forum/#!searchin/julia-box/delete%7Csort:relevance/julia-box/Rt9LG9RldrU/3s_vVSrivJEJ
If you're using windows, it sends it to the recycle bin, thankfully. Clearly, it's a good idea to make checkpoints.
As long as your Kernel is active, the code of each executed cell is stored in input history list. This will come in handy when you accidentally deleted a cell and want to retrieve its content.
_ih[-10:] *# code of the 10 most recently run cells (Even if those cells are deleted now)*
If you are running on Jupyterlab on linux like me. What I did is went into command prompt and went to my trash folder.
Trash directories on linux are typically
/home/$USER/.local/share/Trash
or
If you deleted something as root (e.g. deleted a file using Nautilus invoked via gksu), it is at
/root/.local/share/Trash
I ended up changing directories to /home/$USER/.local/share/Trash/files and my deleted notebook was there! depending on how you access your backend you could also try /home/jupyter/.local/share/Trash/
ps
If you are having issues changing directories from Trash to files due to permissions dont forget to become root:
sudo -i
then after sudo -i, go up with:
cd ..
and then
cd home/jupyter/.local/share/Trash
cd files
Best of luck,
Sadly my file was neither in the checkpoints directory, nor chromium's cache. Fortunately, I had an ext4 formatted file system and was able to recover my file using extundelete:
Figure out the drive your missing deleted file was stored on:
df /your/deleted/file/diretory/
Switch to a folder located on another you have write access to:
cd /your/alternate/location/
It is proffered to run extundlete on an unmounted partition. Thus, if your deleted file wasn't stored on the same drive as your operating system, it's recommended you unmount the partition of the deleted file (though you may want to ensure extundlete is already installed before proceeding):
sudo umount /dev/sdax
where sdax is the partition returned by your df command earlier
Use extundelete to restore your file:
sudo extundelete --restore-file /your/deleted/file/diretory/delted.file /dev/sdax
If successful your recovered file will be located at:
/your/alternate/location/your/deleted/file/diretory/delted.file
I had the very problem and I ended up solving it this way. It might be the case for some of the folks.

Intro. Unix: Changing Directories

I started an online Unix course. I entered the course kinda late and I'm having a little trouble getting caught up. We had a homework question (I got it wrong) it said to:
Change the current working directory to directory WT5 using a single command line and starting at the home path.
How in the world am I supposed to do that? I know how to change a directory from your current directory just $ cd WT5 And if I wanted to list all of the contents in the home directory I would use $ ls ~/nameofhomedirectory And, if I wanted to change the current working directory to the home directory I would use $ cd ~ or just $ cd
So how would I combine all of that in one single command line to change the current directory to another directory using a path that includes the home directory?
Thank you for all of your help in advance!
UPDATE: Okay. I can see now that this maybe a little confusing. So let me try to make it a little bit more clear where I am going wrong or getting mixed up.
Let's say this is a tree of directories you have.
Tree of Directories
Now, your home directory is user And your current working directory is work But you want to change your current working directory to play. How would you change the directory using a single command line and starting at your home direcotry and not your current working directory work
Thanks again!
I'm not quite sure I understand your question, but you could try:
cd ~/WT5
or:
cd $HOME/WT5
or if you absolutely need to be long-winded about it:
cd /user/homedirectory/subdirectory/currentworkingdirectory/WT5
These all include your home directory in the path. The short-hands are to be preferred.
This might do the trick:
cd ~/../users/carol/play
The idea is that you can go upwards from a home directory too.

Problem in creating text file(Qt application) in installation directory (using CMake to install)

I am new to programming. I am creating a small word jumble game to practice qt programming. In this application I am creating a text file (score.txt) to keep score of player. I have done this by:
QFile scoreFile("score.txt");
if (QFile::exists("score.txt"))
{
scoreFile.open(QIODevice::ReadWrite | QIODevice::Text)
// and update the score.
}
else
{
scoreFile.open(QIODevice::ReadWrite | QIODevice::Text);//create score file
//and write the score to it.
}
this code is working good here. Now I am using CMake to build and install generated binary (I am working on Ubuntu) using this code:
#set project name, version and build code here.
install(TARGETS wordJumbleGame DESTINATION bin)
I build project in /home/myname/project/build/
My source code is in /home/myname/project/src/
CMakeLists.txt is in /home/myname/project/CMakeLists.txt
I installed program using make install.
Till here all things working fine. But now problem is that when I run this program (I run it from terminal giving command wordJumbleGame) It creates score.txt in /home/myname/project/build directory. It is not being created in installation dir bin.
So please help me out, what am I doing wrong. And please also tell me how do I make my program to appear in application->game lists so I can run it from there not from command prompt.
Unless you prefix it with a slash (on unix) or a drive path (Windows), QFile's constructor parameter is a relative path - relative to the current working directory. score.txt is created in the build/ directory because that's probably where you're executing the binary from.
You can't store score.txt in the /usr/bin directory because, typically, you can't write there without root privileges.
What you want to do is get a path to some directory where you can store your score.txt file. To do that, you can use the QDesktopServices class. That will give you directory information on a per-user basis. Here's an example:
#include <QDesktopServices>
// this would go in main(), probably
QCoreApplication::setApplicationName( "word jumble game" );
// now when you want to read/write the scores file:
QString dataPath = QDesktopService::storageLocation( QDesktopService::DataLocation );
QFile scoreFile( dataPath + "score.txt" );
// on my system, this produces: "/home/adam/.local/share/data/word jumble game/score.txt"
// it will produce something similar for Windows and Mac too
You should set your appication name via QCoreApplication::setApplicationName before getting path information to keep the user data directory nice and organised.
As for getting your application in the games list, you'll need to create a menu entry that follows the freedesktop.org spec. I can't help you more with that, but this is a good starting point. Somebody else might have more info for you.
You need to create a .desktop entry file and install it using xdg-desktop-menu install. Here are two resources for you: freedesktop.org menu spec and adding .desktop files using CMake

Resources