Checking Gnome's version using Python - version

How do I use Python to check if the Gnome running is Gnome 2 or Gnome 3 ?

Use python to run a command such as "gnome-about –gnome-version" in the operating system shell.
This bypasses distribution and indeed operating system package management nightmares as as long as gnome is installed in path it will respond correctly. No messy uses of apt/yum/pkg_*.
Look at python's Operating System module, specifically the os.system() command. http://docs.python.org/library/os.html#os.system . There are more elegant ways I'm sure, but this'll solve your issue.
Of-course this will only work if gnome is actually installed. I assumed it was given that you were asking what version it was. Lubuntu is a remix of standard ubuntu, and does not come with the full gnome desktop installed by default.
The following command will show installed packages that have gnome in the name.
dpkg -l | grep gnome
To find the exact name of the gnome-desktop package you'd do something like the following:
apt-cache search gnome desktop
And then the following to install a specific package.
sudo apt-get install <package_name_here>

Both gnome 2 and gnome 3 use information from a certain file to display gnome version in System Info. The file in question is called gnome-version.xml
In gnome 3 it is part of the package gnome-desktop so it shouldn't be missing from any gnome 3 install regardless the distro. The difference is that in gnome 2 it's either installed in
/usr/share/gnome-about/gnome-version.xml
or missing, while in gnome 3 it's always located here:
/usr/share/gnome/gnome-version.xml
So I guess it's only a matter of checking for the right file in the right location.

Related

In C, how do I install GL/glx.h , GL/gl.h and GL/glu.h on Mac OS

I have some code which includes the headers GL/glx.h , GL/gl.h and GL/glu.h . I do not even know what these are, and Google is not a lot of help because there is so much noise in the search results. So (optionally) what are they, but more importantly, how do I install them on a Mac (Mac OS 10.15.4). I have installed other stuff using homebrew so that would be my preference.
EDIT: By renaming the headers to OpenGL/glx.h etc, I can now find gl.h abd glu.h but not glx.h.
This answer openGL glx.h missing form xcode 4 mac lion says "If you install XQuartz you get X11 which has glx.h" but this is not correct, at least not for me. I have installed xquartz using brew, but still cannot find glx.h.
Another site suggested installing Xcode, which I did, but that does not contain glx.h either.
Installing xquartz fixed it. OpenGL (at least the versions I found) is insufficient because it does not include glx.h. The page xquartz.org says, "The XQuartz project is an open-source effort to develop a version of the X.Org X Window System that runs on OS X. Together with supporting libraries and applications, it forms the X11.app that Apple shipped with OS X versions 10.5 through 10.7."
So I downloaded and installed xquartz, and then compiled with -I/opt/X11/include instead of -I/usr/X11R6/include, and linked with -L/opt/X11/lib instead of -L/usr/X11R6/lib; as suggested at fatal error 'GL/glx.h' file not found on mac after Xquartz is installed ; and it all worked.

How can i run the command emerge in git?

this is my 1st question here!
On this site: Is there a kdevelop version that i can install on windows? at one of the answers it is required to "Run emerge qt, emerge kdelibs, emerge kde-baseapps, emerge kdevelop and emerge kdevelop-pg-qt". However, when i make this it tells in the cmd.exe: "The command 'emerge' is either misspelled or could not be found." How can I fix this problem?
So, emerge actually installable on Windows if you follow the guide on the https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Windows#Installing_Emerge
For info:
emerge is a command of a Portage package manager (program to install software in the OS).
Portage is an official package manager of the Gentoo Linux OS. Other examples: Ubuntu and Debian Linux use Apt package manager, Fedora Linux uses fpm, ArchLinux uses pacman, etc...

(Mac OSX) Adding libraries to C -specifically gnuplot

I am a begineer trying to get code in C. I am working on a Mac and using xcode. My only past experience has been with java using eclipse and everything was pretty straight forward. I have almost no experience with terminal.
I am required to learn a bit of C for a project I will be working on and the learning of syntax is coming along okay, but I am at a point where I need to include some libraries in my c program. Specifically I am attempting to make plots with gnuplots.
I have downloaded gnuplot-4.6.3 from their repository and I do not even know how to install the files. I have been looking around and have tried using terminal to use the ./configure command when I am in the gnuplot-4.6.3 directory. But I really don't know what I am doing so I don't even know where to go next or what to do next.
Sorry if this is so trivial, I honestly just have never done this before and I cannot find a good tutorial on what to do.
Thanks for any help you can offer.
I would recommend using MacPorts for installing third-party tools and libraries. It knows the dependencies required and will install them as part of the installation.
Download it from macports.org.
Install it, and allow it to modify your ~/.profile so that /opt/local/bin is in your $PATH (any issue then just do export PATH=/opt/local/bin:$PATH from the command line).
sudo port selfupdate
sudo port install gnuplot
Now that will install the library into /opt/local/lib with the include files in /opt/local/include, so now just add that library to your Xcode project. Select the target and in the Build Phases tab open up the Link Binary With Libraries and press the + button and select Add Other. Now find /opt/local/lib/libgnuplot.a (I am assuming that's what it's called; I don't have it installed my self):
Now add /opt/local/include to your Header Search Paths so the compiler can find the gnuplot header files. Select the target and in Build Setting type in "header search" in the search box. Now double-click on the Header Search Path in the target column (or the project column to the right) and add /opt/local/include:
It's fine! You're learning then! Keep up! When I hit this kind of problem you may want to learn about the basis for linux gcc/g++ compilation and linking processes. Then you should learn Cmake and Automake, which are basically packages to configure projects before compiling building.
A typical (good) project in Unix systems build with commands
./configure
make
sudo make install
or
cmake CMakelists.txt
make all
sudo make install
That's what you need to do after downloading a source tarball online to install unix programs.
Now since you are using Mac, there are so-called package installers, one which is macports and homebrew. I personally suggest homebrew than macports here (I've tried both, although macports still outnumber homebrew with the number of repos, homebrew has the newest support, especially when upgrading to a new OS). So to install homebrew you can do
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Execute that in your terminal (see http://brew.sh/) for more information.
Then you could simply install GNUplot by
brew install gnuplot

How do I compile a .c file on my Mac?

How do I compile a .c file on my Mac?
You'll need to get a compiler. The easiest way is probably to install XCode development environment from the CDs/DVDs you got with your Mac, which will give you gcc.
Then you should be able compile it like
gcc -o mybinaryfile mysourcefile.c
You will need to install the Apple Developer Tools. Once you have done that, the easiest thing is to either use the Xcode IDE or use gcc, or nowadays better cc (the clang LLVM compiler), from the command line.
According to Apple's site, the latest version of Xcode (3.2.1) only runs on Snow Leopard (10.6) so if you have an earlier version of OS X you will need to use an older version of Xcode. Your Mac should have come with a Developer Tools DVD which will contain a version that should run on your system. Also, the Apple Developer Tools site still has older versions available for download. Xcode 3.1.4 should run on Leopard (10.5).
In 2017, this will do it:
cc myfile.c
Just for the record in modern times,
for 2017 !
1 - Just have updated Xcode on your machine as you normally do
2 - Open terminal and
$ xcode-select --install
it will perform a short install of a minute or two.
3 - Launch Xcode. "New" "Project" ... you have to choose "Command line tool"
Note - confusingly this is under the "macOS" tab.
Select "C" language on the next screen...
4- You'll be asked to save the project somewhere on your desktop. The name you give the project here is just the name of the folder that will hold the project. It does not have any importance in the actual software.
5 - You're golden! You can now enjoy c with Mac and Xcode.
You can use gcc, in Terminal, by doing gcc -c tat.c -o tst
however, it doesn't come installed by default. You have to install the XCode package from tour install disc or download from http://developer.apple.com
Here is where to download past developer tools from, which includes XCode 3.1, 3.0, 2.5 ...
http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.3.3.3.1
Ondrasej is the "most right" here, IMO.
There are also gui-er ways to do it, without resorting to Xcode. I like TryC.
Mac OS X includes Developer Tools, a developing environment for making
Macintosh applications. However, if someone wants to study programming
using C, Xcode is too big and too complicated for beginners, to write
a small sample program. TryC is very suitable for beginners.
You don't need to launch a huge Xcode application, or type unfamiliar
commands in Terminal. Using TryC, you can write, compile and run a C,
C++ and Ruby program just like TextEdit. It's only available to
compile one source code file but it's enough for trying sample
programs.
Use the gcc compiler. This assumes that you have the developer tools installed.
STEP 1
Just check wheater your MacBook has the compiler or not using this command 👉🏻 clang --version in your command line interface. If the tool exists then you will be able to see the version like this
STEP 2
Next, go to the directory where your source code exists using CMD Interface, then run the command make "filename" without the .c extension.
STEP 3
The final command to run your source code after compiling it is ./filename without the .c extension.
This is how you can compile and run your program on the Macintosh system.

Linux redhat kernel-headers

I'm trying to compile a c programming package (thc-ipv6-0.7) on Linux Redhat 2.6.9-42.ELsmp and it's complaining that it can't find "linux/string.h".
From google, I learned that this is part of the "kernel-headers" package.
If I do "rpm -qa | grep kernel"
It shows that "kernel-devel" is installed (which I think I need), but not "kernel-headers".
A "find / -name string.h" reveals string.h is in fact on the system, in many places, including "/usr/include".
I tried adding "-I/usr/include" to the make file, but got the same error.
My question is, do I need to install "kernel-headers", and if so, where do I find it, and what version?
Normally, you have to install the version of those headers which correspond to the version of the kernel run by the system on which you'll execute the program. In your case in you want to run locally, 2.6.9-42.
The message complains about "linux/string.h" and not "string.h", so you have add a directory having linux as subdirectory.
I'm not knowledgeable enough about redhat to know how to install them (probably an rpm command) and where they will be installed (with Debian and derivatives put them you have to use -I/usr/src/linux-kernel-version/include").

Resources