Thursday, March 14, 2013
When I create a new file or folder, what determines the group that owns it?
The new file or folder will be owned by the same group that owns the directory that you're adding it to (tested on Mac OS X).
How do I make it so all future files and dirs have the permissions I want (for example, 775 rather than 755 for new directories) on a linux machine?
On your linux machine, open the following file via the following command:
sudo vim /etc/pam.d/loginThen, add the following line to it:
session optional pam_umask.so umask=0002Then, restart the machine.
How do I make it so all future files and dirs have the permissions I want (for example, 775 rather than 755 for new directories) on a Mac OS X machine?
On your Mac OS X machine, create or open the following file via the following command:
sudo vim /etc/launchd-user.confThen, copy and past the following text into it:
umask 002Then, restart your computer.
Sunday, March 10, 2013
What does PHP's print_r($_FILES) look like?
<?php
print_r($_FILES);
/*
THE ABOVE CODE OUTPUTS:
Array
(
[image] => Array
(
[name] => aircraft war military fighter pilot cockpit planes vehicles jet aircraft 3000x1928 wallpaper_www.wallpaperhi.com_6.jpg
[type] => image/jpeg
[tmp_name] => /Applications/MAMP/tmp/php/phpzqf0Y6
[error] => 0
[size] => 383379
)
)
*/
Saturday, March 9, 2013
How do I increase PHP's resource limits?
Check/edit your php.ini file for the following settings:
; Maximum amount of memory a script may consume (8MB). memory_limit = 256M ; Maximum size of POST data that PHP will accept. post_max_size = 32M ; Maximum allowed size for uploaded files. upload_max_filesize = 32M
Friday, March 8, 2013
What does PHP's getimagesize function return?
<?php
$getimagesize = getimagesize('example/image/path/file.png');
print_r($getimagesize);
exit;
/*
THE ABOVE CODE OUTPUTS:
Array
(
[0] => 1748
[1] => 1165
[2] => 2
[3] => width="1748" height="1165"
[bits] => 8
[channels] => 4
[mime] => image/jpeg
)
*/
How can I add an existing user to an existing group via the command line on a Mac OS X machine?
dseditgroup -o edit -u your_admin_username -p -a the_username_of_user_you_want_to_add_to_group -t user the_name_of_the_group_you_want_to_add_user_toIf I wanted to add myself to the "www" group I would simply run the following command:
dseditgroup -o edit -u johnerck -p -a johnerck -t user wwwRun the groups command to see that you've been added:
groups
Subscribe to:
Posts (Atom)
About Me
- John Erck
- I code. I figured I should start a blog that keeps track of the many questions and answers that are asked and answered along the way. The name of my blog is "One Q, One A". The name describes the format. When searching for an answer to a problem, I typically have to visit more than one site to get enough information to solve the issue at hand. I always end up on stackoverflow.com, quora.com, random blogs, etc before the answer is obtained. In my blog, each post will consist of one question and one answer. All the noise encountered along the way will be omitted.