By default, migrations are applied to the same database specified by the db application component. If you want them to be applied to a different database, you may specify the db command-line option like shown below:
yii migrate --db=db2
yii migrate/history # showing the last 10 applied migrations
yii migrate/history 5 # showing the last 5 applied migrations
yii migrate/history all # showing all applied migrations
yii migrate/new # showing the first 10 new migrations
yii migrate/new 5 # showing the first 5 ...
yii migrate/mark 150101_185401 # using timestamp to specify the migration
yii migrate/mark "2015-01-01 18:54:01" # using a string that can be parsed by strtotime()
yii migrate/mark m150101_185401_create_news_table # using full name
yii migrate/mark 13...
yii migrate
This command will list all migrations that have not been applied so far. If you confirm that you want to apply these migrations, it will run the up() or safeUp() method in every new migration class, one after another, in the order of their timestamp values. If any of the migrations fa...
We can use Predefined Constants for Date format in date() instead of the conventional date format strings since PHP 5.1.0.
Predefined Date Format Constants Available
DATE_ATOM - Atom (2016-07-22T14:50:01+00:00)
DATE_COOKIE - HTTP Cookies (Friday, 22-Jul-16 14:50:01 UTC)
DATE_RSS - RSS (Fri, 22...
Installation Requirements
The minimum requirement by this project template is that your Web server supports PHP 5.4.0.
Yii2-advanced-app can be installed in two ways. They are
Installing via Composer
Installing from an Archive File
1) Installing via Composer
If you do not already have Comp...
A common pattern in C# is using bool TryParse(object input, out object value) to safely parse objects.
The out var declaration is a simple feature to improve readability. It allows a variable to be declared at the same time that is it passed as an out parameter.
A variable declared this way is sco...
The underscore _ may be used as a digit separator. Being able to group digits in large numeric literals has a significant impact on readability.
The underscore may occur anywhere in a numeric literal except as noted below. Different groupings may make sense in different scenarios or with different ...
Imagine you have the following HTML:
<div>
<label>Name:</label>
John Smith
</div>
And you need to locate the text "John Smith" after the label element.
In this case, you can locate the label element by text and then use .next_sibling property:
from ...
BeautifulSoup has a limited support for CSS selectors, but covers most commonly used ones. Use select() method to find multiple elements and select_one() to find a single element.
Basic example:
from bs4 import BeautifulSoup
data = """
<ul>
<li class="item&quo...
When the destructor for std::thread is invoked, a call to either join() or detach() must have been made. If a thread has not been joined or detached, then by default std::terminate will be called. Using RAII, this is generally simple enough to accomplish:
class thread_joiner
{
public:
thre...
Leading Zeros
let number: Int = 7
let str1 = String(format: "%03d", number) // 007
let str2 = String(format: "%05d", number) // 00007
Numbers after Decimal
let number: Float = 3.14159
let str1 = String(format: "%.2f", number) // 3.14
let str2 = String(format: &...
Download a distributed archive from Binaries section of JMeter from Download Apache JMeter page.
Depending on the version you downloaded, check minimal Java version requirements and install Java if needed. Ensure the JAVA_HOME environment variable is set and points to a correct version.
...