This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MySQL drop table and foreign keys tip - the FOREIGN_KEY_CHECKS variable | |
| By Alvin Alexander. Last updated: Aug 26, 2013 | |
| http://alvinalexander.com/blog/post/mysql/drop-mysql-tables-in-any-order-foreign-keys | |
| MySQL DROP TABLE FAQ: Help, my MySQL database tables have a lot of foreign keys, and as a result it's a pain to use the MySQL DROP TABLE command in my scripts; they keep failing because of all the foreign keys. Is there something I can do to work around this DROP TABLE foreign keys problem? | |
| With MySQL -- and any other database -- any time you want to rebuild your database schema, the first thing you normally do is drop all your old database tables with MySQL drop table statements, and then rebuild them with MySQL create table statements. When you do this, you'll often run into problems dropping the old database tables because of the foreign key relationships between the tables. | |
| For instance, if an orders table has a foreign key link back to a customers table, you can't drop the customers table until you f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fetchFilteredRecords(val) | |
| { | |
| if(val=="custom") | |
| { | |
| $("#custom_filtering").show(); | |
| } | |
| else | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Selectively dumping data with mysqldump | |
| http://www.electrictoolbox.com/mysqldump-selectively-dump-data/ | |
| mysqldump is a command line tool for outputting table structures and data and can be used for backups etc. By default mysqldump will dump all data from a table, but it is possible to select which data to be exported with mysqldump. This post looks at how to do this. | |
| The examples in this post have a table called "mytable" in a database called "test". mytable has three columns: mytable_id, category_id and name, and we will be selectively exporting data that matches a specific category_id. | |
| Using mysqldump to dump all data from the table would look like this, subsituting [username] for your username (the -t flag suppresses the table creation sql from the dump): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| how to add a border to your font. | |
| The right answer is: | |
| #element { | |
| color: yellow; | |
| text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| maxDateType: Date or Number or String | |
| Default: null | |
| The maximum selectable date. When set to null, there is no maximum. | |
| Multiple types supported: | |
| • Date: A date object containing the maximum date. | |
| • Number: A number of days from today. For example 2 represents two days from today and -1 represents yesterday. | |
| • String: A string in the format defined by the dateFormat option, or a relative date. Relative dates must contain value and period pairs; valid periods are "y" for years, "m" for months, "w" for weeks, and "d" for days. For example, "+1m +7d" represents one month and seven days from today. | |
| Code examples: | |
| Initialize the datepicker with the maxDate option specified: | |
| 1 $( ".selector" ).datepicker({ maxDate: "+1m +1w" }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="js/jquery-1.7.2.min.js"></script> | |
| <script> | |
| $(document).ready(function() | |
| { | |
| $('#password').attr('placeholder','Password'); | |
| $('#email').attr('placeholder','E-mail'); | |
| }); | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sequence Note Description | |
| [...] [1] Match a character according to the rules of the | |
| bracketed character class defined by the "...". | |
| Example: [a-z] matches "a" or "b" or "c" ... or "z" | |
| [[:...:]] [2] Match a character according to the rules of the POSIX | |
| character class "..." within the outer bracketed | |
| character class. Example: [[:upper:]] matches any | |
| uppercase character. | |
| (?[...]) [8] Extended bracketed character class | |
| \w [3] Match a "word" character (alphanumeric plus "_", plus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Backslash sequences | |
| regular expressions backslash sequences | |
| A backslash sequence is a sequence of characters, the first one of which is a backslash. Perl ascribes special meaning to many such sequences, and some of these are character classes. That is, they match a single character each, provided that the character belongs to the specific set of characters defined by the sequence. | |
| Here's a list of the backslash sequences that are character classes. They are discussed in more detail below. (For the backslash sequences that aren't character classes, see perlrebackslash.) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get last word from url after a slash in php | |
| preg_match("/[^\/]+$/", "http://www.mydomainname.com/m/groups/view/test", $matches); | |
| $last_word = $matches[0]; // test | |
| OR | |
| Use basename with parse_url: | |
| echo basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get last word in URL and delete what is not necessary | |
| if in $last_word you find also -0.htm then delete -0.htm | |
| I explain my $last_word now shows test-0.htm | |
| But I do not need -0.htm | |
| I only need "test". | |
| How do I say in PHP to delete -0.html and to grab only "test". | |
| $last_word="-0.html"; |