GD apparently not bundled with TideSDK php module - gd

I read this thread:
Does TideSDK have any image manipulation capabilities?
I have tried using gd functions and failed within my TideSDK application, and then I ran get_extension_funcs("gd"); to find out what gd functions were available, and I'm getting a 'null' response. I also checked to find out what ini file is loaded (also null returned). It appears the php module runs pretty thin (understandably). Here are the things I've tried:
using python's PIL library (had similar library issues with python)
using Ruby's chunky_png gem (had the most success here, but kept running into problems figuring out if the gem is loaded, and having to load it each time the ruby 'embedded server' was spooled up
setting up a 'local' php.ini file to attempt to shove the gd library in (out of my depth here)
My experience has been extensively with writing php application code, not so much with environment configurations. Do you have any ideas? Were you able to successfully use the gd library with the TideSDK?
I'm exploring the possibility of reserving a seat with TideKit, but I'm doing an exploratory build to make sure it does all that I need first. Thanks for any help!

Identify a portable CLI (Command Line) image library, in my case, this was ImageMagick. I was able to get this to work via Ruby via Bash. A "portable" image library would be one that:
a. Can run without being installed on the server i.e. doesn't need the names paths to function properly - so as long as you know "where" it is, you can cd to that directory, and get it to work
b. One with an acceptable footprint. It can't be too big, otherwise it will result in a huge download for your application.
Sample code:
### Bash installer for portable build of ImageMagick
#!/bin/bash
# change to scripts directory in Snicket application Contents path
echo "Installing ImageMagick…"
_APPDIR=$1
# _SCRIPTDIR=${1:-.}
_SCRIPTDIR="${_APPDIR}/Resources/scripts"
_HOME=${2:-${HOME}}
echo "Home -> ${_HOME}"
# Figure out directory absolute path
_TODIR=$_HOME/SnicketTools
mkdir $_TODIR
# remove previous installation
_MAGICK_DIR=$_TODIR/ImageMagick-6.8.9
echo "Removing existing directory -> ${_MAGICK_DIR}"
rm -r $_MAGICK_DIR
cd $_TODIR
tar xzvf "${_APPDIR}/Resources/tools/ImageMagick-x86_64-apple-darwin13.2.0.tar.gz"
#if [[ "$3" ]]; then
# #statements
# cp -r ./ImageMagick-6.8.9 $3/
#fi
# delete temporary copy of magic directory
## echo "Deleting temporary files from ${PWD}/ImageMagick-6.8.9 -> "
# rm -r ./ImageMagick-6.8.9
# open $_TODIR
echo "Magic directory (before export): ${_MAGICK_DIR}"
export MAGICK_HOME=$_MAGICK_DIR
echo "Magic directory: ${_MAGICK_DIR}"
echo "Magic home: ${MAGICK_HOME}"
## Clean profile file
_PROFILE=`cat ~/.bash_profile`
echo "Profile information -> ${_PROFILE}"
## You need to add export statements to ~/.bash_profile or ~/.profile
## or /etc/profile file. This will export variables permanently:
echo "# Snicket Magick Config" >> ~/.bash_profile
echo "export MAGICK_HOME=${_MAGICK_DIR}" >> ~/.bash_profile
echo "export PATH=$PATH:${MAGICK_HOME}/bin" >> ~/.bash_profile
echo "export DYLD_LIBRARY_PATH=${MAGICK_HOME}/lib/" >> ~/.bash_profile
echo "# End Snicket Magick Config" >> ~/.bash_profile
# Reload bash parameters
source ~/.bash_profile
## >> appends to an existing file
# source ~/.bash_profile
# check bash profile # open ~/.bash_profile
Next, Bash script for running basic image conversion using the library:
#!/bin/bash
## You MUST change to the magick directory before running in portable mode
# Use from within Ruby
# cmd = "bash #{$BASHDIR}/make_thumbnail.sh \"#{$MAGICK_HOME}#{$DS}bin\" \"#{img}\" \"#{tfile}\""
# cmd = "#{MAGICK_HOME}#{DS}bin#{DS}compress \"#{img}\" -resize 240x240\\> \"#{tfile}\""
_MAGICK_DIR=$1
_SRC=$2
_THUMB=$3
echo "Changing directory to -> ${_MAGICK_DIR}"
cd $_MAGICK_DIR
echo "Converting from ${_SRC} to ${_THUMB}"
source ~/.bash_profile
./convert "${_SRC}" -resize 240x240\> "${_THUMB}"

Related

zshrc outputing cryptic errors on iterm2 at loading

I am a Mac user on osx 10.15.7 (Catalina).
I recently updated brew and upgraded formulas with it.
Since then, my terminal has become erratic and prints out these errors:
_zulu_init_setup_completion:9: compinit: function definition file not found
/user/path/.zulu/packages/tipz/tipz.zsh:86: add-zsh-hook: function definition file not found
_zulu_init:48: promptinit: function definition file not found
_zulu_init:50: command not found: prompt
/user/path/.zprezto/init.zsh:14: is-at-least: function definition file not found
prezto: old shell detected, minimum required: 4.3.17
/user/path/.zshrc:19: promptinit: function definition file not found
/usr/local/Cellar/zplug/2.4.2/autoload/init.zsh:16: colors: function definition file not found
polling.zsh:17: add-zsh-hook: function definition file not found
# the following line is repeated at least 20 times
__zplug::core::core::get_interfaces:49: regexp-replace: function definition file not found
__zplug::core::core::prepare:67: compinit: function definition file not found
[zplug] ERROR: The loading of zplug was discontinued.
/user/path/.nvm/bash_completion:87: bashcompinit: function definition file not found
/user/path/.nvm/bash_completion:88: compinit: function definition file not found
/user/path/.nvm/bash_completion:95: command not found: complete
/user/path/.zshrc:35: command not found: gcloud
/user/path/google-cloud-sdk/completion.zsh.inc:1: bashcompinit: function definition file not found
/user/path/google-cloud-sdk/completion.zsh.inc:4: compinit: function definition file not found
/user/path/google-cloud-sdk/completion.zsh.inc:37: command not found: complete
/user/path/google-cloud-sdk/completion.zsh.inc:62: command not found: complete
/user/path/google-cloud-sdk/completion.zsh.inc:63: command not found: complete
I am not very versed into bash I think my installation might have been way to complex also (oh-my-zsh, prezto, powerlevel10k).
I just would like to know how to weed out the error and fix this.
my zshrc looks as follow
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <sorin.ionescu#gmail.com>
#
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Initialise zulu plugin manager
source "${ZULU_DIR:-"${ZDOTDIR:-$HOME}/.zulu"}/core/zulu"
zulu init
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
# Customize to your needs...
autoload -Uz promptinit
promptinit
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
# export PATH="$PATH:$HOME/.rvm/rubies/ruby-2.4.1/bin/"
# loading ZPLUG
export ZPLUG_HOME=/usr/local/opt/zplug
source $ZPLUG_HOME/init.zsh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:/user/path/Library/Python/3.7/bin:$PATH"
export GOOGLE_PROJECT="$(gcloud config get-value project)"
export GOOGLE_APPLICATION_CREDENTIALS="/user/path/PROJECTS/personal/k8s/gcp-k8s-credentials.json"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/user/path/google-cloud-sdk/path.zsh.inc' ]; then . '/user/path/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/user/path/google-cloud-sdk/completion.zsh.inc' ]; then . '/user/path/google-cloud-sdk/completion.zsh.inc'; fi
# iziwork key
export GITHUB_AUTH_TOKEN=xxx
EDIT
Bash Version : echo $BASH_VERSION gives a blank line.
Zsh Version : 5.7.1
prezto: old shell detected, minimum required: 4.3.17
Check your zsh version
zsh --version
In the end there were several issues, following the upgrade of brew some path did not get properly upgraded in the .zshrc file:
fpath in ~/.config/zulu was pointing to an older or incorrect version of zsh (particularly .../zsh/function)
path for zplug was incorrect
some gcloud command called before setting the path to gcloud
so
#this
/usr/local/Cellar/zsh/5.8/share/zsh/functions
#became
/usr/local/Cellar/zsh/5.8_1/share/zsh/functions
and
#this
export ZPLUG_HOME=/usr/local/Cellar/zplug/2.4.2/autoload/zplug
#became this
export ZPLUG_HOME=/usr/local/Cellar/zplug/2.4.2

How to reload vim/gvim config in all running instances from outside vim/gvim

So for example, i would have a command i could run from a bash script, and all open gvim and vim sessions would reload their config.
This is already the whole question, really, but I will also include my specific issue:
I want to be able to change between a light and a dark theme on the fly from a script.
i have these files in ~/:
.vimrc # contains "source ~/.vimrc_theme"
.vimrc_theme # is a symbolic link to either of the following two files
.vimrc_theme_light # contains "colorscheme morning"
.vimrc_theme_dark # contains "colorscheme evening"
and my theme-changer script:
#!/bin/bash
# should be either "light" or "dark"
_mode=${1:-light}
cd \
&& rm .vimrc_theme \
&& ln -s .vimrc_theme_${_mode} .vimrc_theme \
&& touch .vimrc \
&& touch .gvimrc
This question deals with a similar thing. There, one wants to edit .vimrc from inside vim, and then reload it. I want to trigger a reload from the outside.

Why I can use relative path and absolute path on may MacVim?

I just started to learning C Language.
My system is OS X 10.10 and MacVim 7.4.383 compiled by myself because I need it support python3.
But I find if a just double cilck the MacVim.app and :open ~/Desktop/something.c, it will tell me that something.c is a new file. But I did have a file called something.c on my Desktop, and I search the reason of situation, it seem to there is something about environment variable, so I follow the guide to add this code to file:///etc/launchd.conf
setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
and restart my computer, it didn't change anything
and my /etc/bashrc is
System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\d \A \u # \H \w #\#: \$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
# ===== ===== ===== =====
# Custom Setting
export CLICOLOR=1
export LSCOLORS=gxfxaxdxcxegedabagacad
export HISTSIZE=250
# Setting PATH for KDE
export KDEDIRS=$KDEDIRS:$HOME/Library/Preferences/KDE:/usr/local/kde4
export PATH=/usr/local/kde4/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/kde4/lib:$DYLD_LIBRARY_PATH
launchctl setenv DYLD_LIBRARY_PATH /usr/local/kde4/lib:$DYLD_LIBRARY_PATH
export XDG_DATA_HOME=$HOME/Library/Preferences/KDE/share
export XDG_DATA_DIRS=/usr/local/kde4/share:/usr/local/share:/usr/share
# Setting PATH for MySQL
export PATH=$PATH:/usr/local/mysql/bin/
# Setting PATH for Node.js and NPM
export PATH=$PATH:/usr/local/bin/node
export PATH=$PATH:/usr/local/bin/npm
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
And if I used absolute path like this
:open /Users/XXX/Desktop/something.c
it will print an error
E479:Not match
E32:No file name
So, what can I do to make the MacVim work like just under linux, thank you.
:open is not used for opening a file. You need to use :edit or :e command for that.
You can just use:
:e /Users/XXX/Desktop/something.c
Also $PATH doesn't have any impact on :e command.
As per vim help:
1: Simulated command simulated-command
This command is in Vi, but Vim only simulates it:
*:o* *:op* *:open* :[range]o[pen] Works like |:visual|: end Ex mode.
{Vi: start editing in open mode}
:[range]o[pen] /pattern/ As above, additionally move the cursor to the
column where "pattern" matches in the cursor
line.
Vim does not support open mode, since it's not really useful. For
those situations where ":open" would start open mode Vim will leave Ex
mode, which allows executing the same commands, but updates the whole
screen instead of only one line.

My Bash aliases don't work

I'm not sure why but my Bash aliases don't seem to work. Here is my .bashrc file
# v 0.0.1 - 7/03/12
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
# expanding history to 10000 commands
export HISTSIZE=10000
# don't store repeated commands more than once
export HISCONTROL=ignoredups
# where to look for Java
export JAVA_HOME=/Library/Java/Home
# tomcat server configuration
export CATALINA_HOME=/usr/local/apache-tomcat-6.0.35
# default editor
export EDITOR=vim
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Here is my .bash_aliases file
# v 0.0.1 - 7/03/12
# aliases for directory traversal
alias ..='cd ../'
alias ...='cd ../../'
alias ....='cd ../../../'
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias go='git checkout '
alias gk='gitk --all&'
alias gx='gitx --all'
alias got='git '
alias get='git '
Add this to the end of your .bashrc:
if [ -f $HOME/.bash_aliases ]
then
. $HOME/.bash_aliases
fi
I had a similar problem recently. The solution appeared to be closing ALL open shells (root and user; I didn't notice that I was running a minimized root shell at the time while editing my user .bashrc and .bash_aliases files). The .bash_aliases file then seemed to get read.
By default
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
These are available in your .bashrc file in ubuntu 18,19
Actually the problem is sourcing the files, therefore source both files by runing the commands below. I faced the same issues and that is how i solved it.
source ~/.bashrc
source ~/.bash_aliases
Bash doesn't look for a file called .bash_aliases; you have to source it explicitly.
Looking around a bit, it appears ~/.bash_aliases is sourced from the default .bashrc on Ubuntu boxes; I don't have access to one to confirm. However, it is not a standard bash configuration file.
I recently installed RVM and changed my terminal profile to "run command as login shell". This disabled .bashrc from loading.
Fix: edit -> profile preferences -> Title and Command -> Run command as a login shell (uncheck)
Find this post for more information, fixed it for me.
https://askubuntu.com/questions/161249/bashrc-not-executed-when-opening-new-terminal
Sometimes forgetting to source the bashrc also creates this problem. So after adding your aliases don't forget to source it.
source ~/.bashrc
You need to include the file. Example code to do so from a default .bashrc file is below:
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
don't forget to
chmod 600 ~/.bash_aliases
on kubuntu 22.04
;)
It may be something simple. Like you are actually running zsh or korn instead of bash. Check your shell. I have done this on installing and testing various flavors. Wasted so much time I now never assume I am on bash anymore.

How can I get rid of something running on every new terminal session?

I am using Lion. I have an error that outputs on every new terminal session:
-bash: __rvm_add_to_path: command not found
It's an almost brand new user account.. RVM is installed on the other account on the machine.. ~/.bashrc & ~/.bash_profile are both blank.. the out put of env is:
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/ry/8zsyknmx7dj4_2zzvn1n71500000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-jsfKPw/Render
TERM_PROGRAM_VERSION=303
TERM_SESSION_ID=3EBC0F1A-9867-41E5-8873-75E84B9F712F
USER=incorvia
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-ZQqgPj/Listeners
Apple_Ubiquity_Message=/tmp/launch-u3d1lp/Apple_Ubiquity_Message
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin
PWD=/bin
LANG=en_US.UTF-8
HOME=/Users/incorvia
SHLVL=1
LOGNAME=incorvia
DISPLAY=/tmp/launch-0B0I8s/org.x:0
_=/usr/bin/env
I see nothing related to RVM here.. where else can I look?
=====
/etc/bashrc
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
return
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
update_terminal_cwd() {
# Identify the directory using a "file:" scheme URL,
# including the host name to disambiguate local vs.
# remote connections. Percent-escape spaces.
local SEARCH=' '
local REPLACE='%20'
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
printf '\e]7;%s\a' "$PWD_URL"
}
PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi
=========
Fixed...
In the bottom of my /etc/profile it was sourcing /etc/profile.d/rvm.sh
Don't know how that got there...
Bash loads a series of files during startup. A good overview of the bash startup process can be found here.
Generally, the global settings, /etc/profile, /etc/bashrc, and the associated personalized settings, ~/.profile and ~/.bashrc are loaded, although that is slightly distribution-dependant (and on Mac OS X, for example, by default /etc/profile doesn't exist).
From the RVM Installation page:
Multi-User:
The rvm function will be automatically configured for every user on the system if you install as root. This is accomplished by loading /etc/profile.d/rvm.sh on login. Most Linux distributions default to parsing /etc/profile which contains the logic to load all files residing in the /etc/profile.d/ directory. Once you have added the users you want to be able to use RVM to the rvm group, those users MUST log out and back in to gain rvm group membership because group memberships are only evaluated by the operating system at initial login time.
I'd guess that the other use has installed in Multi-User mode;
/etc/profile probably loads /etc/profile.d/rvm.sh.
To stop it being loaded, you could remove the source RVM line from /etc/profile - this will stop it being loaded for all users, though.
For the account that had a working profile, I had the following .rvmrc:
root#sc-27617:~# cat .rvmrc
export rvm_prefix="/usr/local/lib/sc"
export rvm_path="/usr/local/lib/sc/rvm"
To get the error to go away for my other accounts, I simply copied this file to the other accounts and fixed the permissions (chown johndoe:johndoe /home/johndoe/.rvmrc)...
In Ubuntu 12.04, by default, the /etc/profile.d/rvm.sh will not be loaded when starting a new terminal. So every time, when starting a new termail, cmd as follows must be used to start rvm:
source /etc/profile.d/rvm.sh
And there are two ways to fix it:
open a new terminal-> right click and select Profiles->Profile Preferences->Title and Command->select "Run command as a login shell".
open a new terminal->run cmd as follows then the /etc/profile.d/rvm.sh will be auto loaded in a new terminal:
echo '[[ -s "/etc/profile.d/rvm.sh" ]] && . "/etc/profile.d/rvm.sh" # Load RVM function' >> ~/.bashrc
As some explanation here to say the 1st solution is not a nice one but the 2nd is suggested.
So in other way round, if you do not want the terminal to run something in a new terminal, you need to check whether the auto load is coursed by the two ways:
check whether the "Run command as a login shell" is selected and unselect it.
open the ~/.bashrc file ,find the lines related loading the function and delete it.
I had the same file (/etc/profile.d/rvm.sh) from a previous rvm installation. Deleting that file worked for me as well.
For the sake of being thorough, logging out of the shell seems to be required.
In your /etc/profile change the line:
source /etc/profile.d/rvm.sh
into:
if [ "${SHELL}" != "/bin/sh" ]; then
source /etc/profile.d/rvm.sh
fi
Why?
In Mac OS X the default shell of superuser (root) is a POSIX shell, not a pure Bash. Adding such condition will disable rvm for (possibly) emerygency shell /bin/sh, used by system administrator. That is good. If you would like to install something using root's account, you can always type bash and then rvm … in a command line.
Debian 6.1 scans the /etc/profile.d/ file for all .sh files and includes them, so there's no listing for rvm in any of the profiles or .bashrc files anywhere. Deleting rvm.sh from /etc/profile.d/ solves this.
if you have ZSH or OH-MY-ZSH, then you need to remove source /etc/profile.d/rvm.sh from /etc/zprofile

Resources