Spotipy Autorized Requests export environment variables - spotipy

I'm trying to access spotify via the spotipy API from a win10 pro (64Bit) system.
In the spotipy documentation it says "...you can set environment variables like so:
export SPOTIPY_CLIENT_ID='your-spotify-client-id'" ...
Of cource I can use "var SPOTIPY_CLIENT_ID='your-spotify-client-id'" in my
script but I'd like to know what this export command means exactly.
Is that the export known from a Linux system?
I set the necessary spotify variables as environment variables in Win10 but they still were unknown.
Does anyone have an idea what it means exactly and how to get it working in win10?
Thanks

While it is better practice to set the environment variables if you just want to get up and running you can still pass in those values into the call in your code.
token = util.prompt_for_user_token(myUsername, scope, myClientId, mySecret, myRedirect)
There is info on wikipedia about how to set them.
Also refer to this StackOverflow answer.

I don't know if it will work for python scripts, but the windows commands you want would be:
SetX SPOTIPY_CLIENT_ID your-spotify-client-id
Souce: http://ss64.com/nt/setx.html

for windows 10 powershell terminal use $env: instead of export(for macs) and put your code string in quotes:
$env:SPOTIFY_CLIENT_ID="XXXX"

Related

Is there a way to get help for some C functions inside of vim/Neovim?

This question may be a little off topic. But I was wondering if there was a way for me to look at the descriptions of C functions using vim or neovim. Is it possible to look at their documentations by doing something like :help? This would really be helpful since I wouldn't need to lookup to my browser everytime.
I am unclear about these things:
Can :help be my friend here ?
Can I use LSPs to do something like this ?
I am using latest Neovim inside Ubunutu 20.04 in WSL. Is this helpful somehow ?
By pressing K, the keyword under the cursor is looked up using a configured keyword lookup program, the default being man. This works pretty much out of the box for the C standard library.
For C++, you might want to look at something like cppman.
Well yes, you can get the description of C functions by using a LSP (language server plugin)! Here is an image of me using clangd as my LSP:
You'd "just" need to install the LSP and start it. I don't know how familiar you're with neovim, but just in case if you don't know how to install a plugin or to be more specifique: If you don't know how you can install a LSP server, then you can do the following:
There're plenty videos how to set up a LSP-Server for your language. Here's an example.
If you don't want to set up on your own, you can pick up one of the preconfigured neovim setups (some of my friends are recommending lunarvim)
But yeah, that's it. If you have any further questions feel free to ask them in the comments.
Happy vimming c(^-^)c
Let's explain how "K" command works in more detail.
You can run external commands by prefixing them with :! command. So running man tool is as easy as
:!man <C-R><C-W>
Here <C-R><C-W> is a special key combination used to put word under cursor from text buffer down to command line.
Same for showing Vim's built-in help page
:help <C-R><C-W>
As it feels tedious to type that, Vim also defines K Normal mode command that does pretty much the same thing. Except the tool name is taken from value of an option named "keywordprg".
So doing set keywordprg=man (default for *nix systems) makes K to invoke !man tool; while set keywordprg=:help is for bultin help.
Also, the option :h 'keywordprg' is made global or local-to-buffer, so any Vim buffer is able to overwrite global setting. For example, this is already done by standard runtime for "vim" and "help" buffers, so they call ":help" instead of "man".
The problem with :!man command is that it shows "black console". It'd be nice if we could capture man's output and open it inside Vim just like a builtin help page. Then we could also apply some pretty highlighting, assign key macros and all such. This is a pretty common trick and it is already done by a standard plugin shipped with Vim/Neovim.
A command that the plugin provides is called :Man, so you can open :Man man instead of :!man man, for example. The plugin is preactivated in Neovim; for Vim you still need to source one file manually. So to make use of this plugin you'll need something like this
set keywordprg=:Man
if !has("nvim")
source $VIMRUNTIME/ftplugin/man.vim
endif
The previous answer recommending cppman is the way to go. There is no need to install a bulky language server just for the purpose of having the hover functionality. However, make sure you're caching the man pages via cppman -c. Otherwise, there will be a noticeable delay since cppman is fetching the page from cppreference.com on the fly.
If you like popups for displaying documentation, convert the uncompressed man pages (groff -t -e -mandoc -Tascii <man-page> | col -bx), and set keywordprg to your own wrapper to search for keywords according to your needs.

Setting apache environment variable using C, function similar to PHP apache_setenv function

I want to set some information in apache environment variable in a c program which I would like to log into custom log file. I am looking for some c function which is similar to PHP apache_setenv function.
Pointers would be very much appreciated. Thank you
Hava a look in howto write CGI program, it's probably the way to go. Anyway, I'm not sure if it's possible to set apache vars this way.
http://httpd.apache.org/docs/2.2/howto/cgi.html
you can do it by calling this function
apr_table_addn(r->subprocess_env, "env_name", "env_value");
Where env_name and env_value are name and value of environment variable respectively.
and r is request_rec structure pointer object

Osgviewer cow does not view a cow?

I installed OpenSceneGraph 3.0.1using MacPorts.
I've tried osgversion -> OpenSceneGraph Library 3.0.1. I downloaded the OpenSceneGraph-Data.
Everything seems working well than osgviewer cow.osg takes hours without viewing anything !
please I need help ? is there a way to debug ?
Make sure you have defined the OSG_FILE_PATH environment variable and that it points to the data directory (the one with 'cow.osg').
You can then set OSG_NOTIFY_LEVEL to DEBUG_INFO to get extended information printed to the console. If for any reason the file could not be loaded correctly you will see where to start to troubleshoot.
You can also try to run
$ osgviewer --image /path/to/an/image.png
to test if the plugins work correctly.
Plugins are named e.g. osgdb_jpeg.dylib so you can look for these to make sure they have been built properly along with the core libraries and programs.
Try setting the notify level to DEBUG : Tips And Tricks
$ export OSG_NOTIFY_LEVEL=DEBUG
and run it and see if it says what's going on/going wrong.

Lua: %UserProfile% access

I tried searching for this information, but no luck.
What I'm attempting to do is access a variable path in Lua, so instead of having to change a path to its absolute value each time, I can just do: C:/%UserProfile%/path instead. Is there a way to do this?
I saw a luafilesystem site, but it didn't seem to do what I needed it to do. Essentially, what I'd like to do is the following:
savepath = "%UserProfile%/Saves"
It won't matter if I have to have two steps or just one, just as long as it works.
os.getenv (varname)
Returns the value of the process environment variable varname, or nil if the variable is not defined.
--Lua 5.1 Reference Manual

Does LoadLibrary parse environment variables such as %windir%

If I do LoadLibrary("%windir%\\system32\\ole32.dll") does that mean Windows will ONLY load from "c:\windows\system32\ole32.dll" ? Also does LoadLibrary() in C understand the environment variable?
as Serge said and carefully tested, LoadLibrary does not do environment variable substitution in path.
however, there is a function in the windows API to replace environment variables in strings: ExpandEnvironmentStrings(). you can perform the required substitution on your path before calling LoadLibrary().
The docs for LoadLibrary clearly state that:
If the string specifies a full path, the function searches only that
path for the module.
That said, they don't mention support for environment variables substitution. I seriously doubt they do support environment variables substitution: That's a shell feature, not a kernel API one.
BTW, that means LoadLibrary() would consider %windir%\blah.dll as a relative path since it doesn't start with a drive letter or a UNC path. Hence it would look through the whole series of directories, looking for a subdir named %windir%, which it's not likely to find!
I gave it a quick test: It confirms my opinion. Error = 126 : The specified module could not be found.

Resources