mysql not in my PATH for some reason - mysql

I've installed mysql on several macs and on one of them mysql is not in the path. If I export it it shows up in the path correctly, but upon reboot, disappears.
What should I do to get the machine to keep it in the path and what are the machines that DO have it in their path doing differently?
Any thoughts appreciated.

Check the /etc/profile file on the macs it's working on. The path file should be defined there, which would be for all users. The ~/.bash_profile mentioned is for an individual user.
You should see something similar to the previously mentioned
export PATH=/path/to/mysql_folder:$PATH
in this file, though it may be a bit buried. If you don't see PATH defined here, try /etc/environment. Failing this, I'm not sure where else OS X would define the path variable, but being a Unix system, there is a common file read by all profiles where it sets it.
Once you find it, compare the definition on the machines it works on to the one it doesn't, and edit accordingly. If it looks the same, then something's amiss, and you should let us know.

if it is linux you have to add this export to your profile script. if windows edit PATH in My Computer | Properties | Edit environmental variables

To one of your init files (such as /home/username/.bash_profile) add a line like:
export PATH=/path/to/mysql_folder:$PATH

Related

yii2: model relations error can't find another class in ubuntu server 16.04

I have upload my YII2 project to ubuntu 16.04.
My source is no problem when run on localhost on my computer, but when I run it on the server ubuntu 16.04 with network, it has a problem.
The model source can't find another relation model
public function getLokasiAwal()
{
return $this->hasOne(KotaBandara::className(), ['id_kota' => 'lokasi_awal']);
}
and i have error
Class 'backend\models\TypeNonstaf' not found
I have found the solution, I added the following code:
use backend\models\Kotabandara;
On top in model file but, in my source in localhost,
I do not need to add that code
Can someone explain that issue??
As #rob006 pointed out, it appears that you had been working/running your app on a Windows local file system, which is case-preserving, but not case-sensitive.
When you first call upon a namespaced class directly or via the use operator, it passes this full class name as $className into yii\BaseYii\autoload::($className) (Yii2's global class autoloading handler), which in turn attempts to include the corresponding class file, if found.
So, on your Windows local machine, when you use backend\models\KotaBandara, it will find and include any file associated with the corresponding path alias in a case-insensitive manner, thus it will find any of:
#backend/models/KotaBandara.php
#backend/models/Kotabandara.php
#backend/models/kotabandara.php
#backend/models/KoTaBaNdArA.php
There can be only 1 target file with this sequence of paths/characters anyway.
However, when you migrate this code to a Ubuntu system, which is both case-preserving and case-sensitive, there is a distinct difference between KotaBandara.php and kotabandara.php and in fact both files can exist side by side, unlike on Windows.
So, you have to be precise here - on Ubuntu, use backend\models\KotaBandara will trigger the autoloader to find only the file whose path AND case matches, i.e. KotaBandara.php. If you named the file kotabandara.php, it will be found on Windows, but not on Ubuntu!

Corrupt Wampserver - how to recover?

My laptop crashed this morning after which the wampmanager.ini was corrupted. I found out how to resolve that by pasting in a replacement and ensuring that this line pointed to the correct directories:
Action: run; FileName: “c:/wamp/bin/php/php5.4.3/php-win.exe”;Parameters: “refresh.php”;WorkingDir: “c:/wamp/scripts”; Flags: waituntilterminated
However, I still get an error "Exception Eception in module wampmanager.exe at 000F15A0. Could not execute run action: The directory name is invalid.
I have check: “c:/wamp/bin/php/php5.4.3/php-win.exe” and “c:/wamp/scripts”. I even pasted them into the address line at the top of the page to make sure and they were found.
What are my options please?
Can I run a repair?
Is it just quicker to reinstall?
If I reinstall which directories do I need to copy in order to save my database?
I do not know much about this so if you can be specific please that would be very much appreciated (e.g., full file paths where possible).
Thanks,
Glyn
I have found this:
http://forum.wampserver.com/read.php?2,71125,printview,page=1
https://superuser.com/questions/373255/wamp-not-working-on-windows-7-64bit
Now I need to work out whether I am using WampServer 32 bit or 64 bit. How do I do this please?
You are nearly there, wampmanager.ini is recreated every time you run wamp. What you actually need is an uncorrupted wampmanager.tpl.
If you have a backup, replace the wampmanager.tpl file in \wamp
SECOND ANSWER:
You could try this.
Rename the old wamp folder.
Install WAMP again, using the same version of wamp Apache,MySQL.
Copy your database's from old location to new location + any website code.
That should get you back to where you were roughly.
In my case it happenned because I moved by mistake folder "scripts" from "C:\wamp" to "C:\wamp\tmp". I put it back and it works now.
I found this soltion looking in "wampmanager.ini" (section [StartupAction]) the directories expected to find, and I saw that "scripts" was missing.

TCL/TK - Get Desktop path

My TCL/TK application prompts the user to choose a location where to save a file.
What should the value of the -initialdir option be so that the Desktop is the default location?
I tried %userprofile%\desktop, but it's not working.
set dir [tk_chooseDirectory -title "Where do you want to save the config file?" -initialdir %userprofile%\desktop]
Thanks
The safest way is to use twapi's get_shell_folder command with the argument "csidl_common_desktopdirectory" to get the path to the "all users" desktop directory, or "csidl_desktopdirectory" to get the current user's desktop.
If you don't want to depend on twapi, the paths can be found in the registry, but I don't know how reliable it is. For example:
package require registry
puts [registry get "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders" "Desktop"]
This returns "%USERPROFILE%\Skrivbord" on my system. You still have to expand the USERPROFILE variable (and any other variables). That's best done with twapi::expand_environment_strings, but since you're not using twapi, try regsub:ing %USERPROFILE% with $env(HOME) instead.
Or if you don't care about people with non-english Windows, just use "~/Desktop".

MODX: where are new_folder_permissions and new_file_permissions?

Those are asked during the installation, but are not anywhere in config files\tables to change afterwards
EDIT:
The changelog states the following:
[#MODX-760], [#MODX-1080], [#MODX-1528] Added setup option to set new_file_permissions and new_folder_permissions in welcome view
[#MODX-760], [#MODX-1528] Removed new_file_permissions and new_folder_permissions system settings from setup
Seems kinda weird to me to do that... I am still in need to change them, though.
It appears that these should be in your MODX System Settings although I wasn't able to locate them in any of my own MODX installs (all Revo 2.1+). There's a chance they might be redundant or are for some reason not being properly created during installation (in which case it might be an installer bug).
You might be able to override them by adding those settings, like so:
Key: new_folder_permissions
Value: 0755
Do that and then try creating a new folder using the File Manager. Let us know if the correct permissions are then being used. If so I'll look at opening up a bug report for the installer.
They are not in System Settings, as they default to the PHP umask values, as they should. If you want to override them, you can do so by adding the settings "new_file_permissions" or "new_folder_permissions" to your System Settings.
apache/webuser needs to write to:
core/cache
core/export
core/config/config.inc.php [change back after install]
core/packages
core/components
assets/components
EDIT Sorry, take a look here: core/model/modx/processors/system/filesys/folder/create.php
they appear to be hard coded in that file.

Hard link to a file not working as expected on OS X

I've a file in a folder and I don't know anything about this file (how it's generated and updated) because it comes from an application running on my system of which I don't have the source code.
The file format is clearly json and I successfully created an hard link to it (using the shell command ln file hardLinkToFile) and placed it on another directory.
At this point I check the "2" files and they are exactly the same as expected, but when I perform an action in the application that cause an update of the original file the hard link doesn't get updated.
Any idea on how I can solve this problem?
UPDATE: As pointed out by both Vlad Lazarenko and mvds the file probably get deleted and a new one is created, is there something I can do to obtain a solution equivalent to the hard-link one I thought initially about?
If a hard link is not getting updated, it means that application is removing the old file and creates a new one. Thus, you still have a hard copy of the previous file, but new file has a totally different inode, though path is still the same. You can verify it simply by changing the content of that file yourself - the link should get updated.
I am getting the same behavior in TextEdit, but not in TextMate. I would suspect this is due to the revision control built in to OS X Lions document architecture. TextEdit uses versioning, while TextMate does not. Most likely this function replaces the file instead of changing it, as described by #Vlad Lazarenko.
#Vlad and Francesco. It's really in this way. I verified that vi leaves the inode unchanged and the src and dest file are both changed, while e.g. the kate editor doesn't and I was getting mad to understand why the changes I made in the src file weren't also in the dest file.
You can easily check this with the command ls -li srcfile destfile before editing one of them with each editor I mentioned.
By the way it's not nice that the hard link are application dependent
I guess it is a bit too late...
Anyways, accidentally I found that, if you change the default app for the file, the hard link gets separated from original file. Even if you click on change all and do not relate to that specific file.