Wednesday, March 13, 2013
Tuesday, February 26, 2013
Some useful BASH shell hot keys and useful tips.
Check out these hot keys. They can help a lot to save your time.
Since I started using them, I'm just a new man :)
This one is so important, that I'll write it separately.
These commands are also very useful. When I say they are "useful", I really mean that I use them! :)
Since I started using them, I'm just a new man :)
This one is so important, that I'll write it separately.
| Ctrl+R | To search in previous commands. It displays the last occurrence. |
| Ctrl+R+R | It displays the occurrence before the last. |
These commands are also very useful. When I say they are "useful", I really mean that I use them! :)
| Ctrl+K | To delete the characters from the cursor to the end of the line. |
| ESC+D | To delete the characters from the cursor position to the end of the word |
| Ctrl+A | To move the cursor to the beginning of the command line |
| Ctrl+E | To move the cursor to the end of the command |
| Ctrl+L | To clear the screen, puts the current command line at the top of the screen |
And I've got one additional tip for you. Use aliases!
Don't be lazy. It's so worth it!
To create your own alias, edit the file ~/.bashrc. Put there your alias.
Here is my alias that I use very frequently:
alias pr='cd /var/www/myprojects'
In this file you can see already added aliases.
To check them out, you can also use alias command.
Wednesday, February 20, 2013
How to get list of available timezones in php
<?php
print_r( DateTimeZone::listIdentifiers( ) );
?>
Labels:
php
Saturday, February 16, 2013
Some basic UNIX commands
Today I will write down some basic UNIX commands.
"cd -" will switch you to the previous directory.
"cd ~" or "cd" will switch you to your home directory.
"pwd" (print working directory) is used to output the path of the current working directory.
"cd -" will switch you to the previous directory.
testuser@test:~/Downloads$ cd ../Desktop/
testuser@test:~/Desktop$ cd -
/home/testuser/Downloads
testuser@test:~/Downloads$
"cd ~" or "cd" will switch you to your home directory.
testuser@test:~/Downloads$ cd ../Desktop/
testuser@test:~/Desktop$ cd -
/home/testuser/Downloads
testuser@test:~/Downloads$
"pwd" (print working directory) is used to output the path of the current working directory.
testuser@test:~/Desktop$ pwd
/home/testuser/Desktop
Monday, December 10, 2012
How to found out extra fields in Symfony2 form?
If you encounter this error message while working with Symfony2 forms, follow my advice.
This form should not contain extra fields.
This way to find out the fields that are considered "extra" is very simple. I use the code quite frequently.
Here it is:
$data = $request->request->all();
print("REQUEST DATA<br/>");
foreach ($data as $k => $d) {
print("$k: <pre>"); print_r($d); print("</pre>");
}
$children = $form->all();
print("<br/>FORM CHILDREN<br/>");
foreach ($children as $ch) {
print($ch->getName() . "<br/>");
}
$data = array_diff_key($data, $children);
//$data contains now extra fields
print("<br/>DIFF DATA<br/>");
foreach ($data as $k => $d) {
print("$k: <pre>"); print_r($d); print("</pre>");
}
...
$form->bind($data);
Have a nice day!
Labels:
extra fields error,
symfony2,
symfony2 forms
Subscribe to:
Posts (Atom)
