I had install Rights module inside my application. The Rights module itself wouldn’t auto integrate with the controller.
So I need to integrate myself, at each of the controller we need to add 2 extra function they are:
public function filters() {
return array(
'accessControl',
);
}
and
public function accessRules() {
return array(
array('allow',
'action' => array('Index'),
'users' => array('@'),
),
);
}
Posted by
chevrons in
Yii
I am making a little code to test the functionality server with MSSQL Database connection. The test code was develop with asp.net C#.
If the script successful connect with MSSQL Database it will display message like below:
TESTS COMPLETED SUCCESSFULLY!.
Else, it will display
TESTS FAILED!
Server script:
By default, IIS and ASP.NET hide detailed error information to prevent revealing sensitive information about your web application.
Sometimes we need to see error details (think shared hosting) to debug our coding.
To display the error message. Add these entries to your web.config file to disable generic errors:
Have 2 methods to do it.
Method 1:
echo eval('return $'. $string . ';');
And another method as below:
$counter = 1;
$button1 = "Hello PHP";
$printbutton = ${'button' . $counter};
echo $printbutton
The Method 2 example will print out
Hello PHP
Posted by
chevrons in
PHP
Installing PHP itself is quite straightforward; the difficulty lies in configuring IIS to use it! There are a number of programs contained within the standard Win 32 distribution, for example it contains two versions of the PHP interpreter that we can use with IIS. The first is a DLL (Dynamic Link Library) that contains an ISAPI module for IIS. This module will run as a persistent interpreter in IIS, one that does not need to be called externally, so in theory should provide the best performance.
In reality, I have found the ISAPI module to be unstable with PHP 5 and IIS on Windows, often causing access violations. These issues will most likely be resolved in time, and may be by the time that you are reading this.
The second version, a standard C executable, is the one that we will be using. This runs under IIS as an external CGI (Common Gateway Interface) call, similar to the way Perl/CGI works, so as a result is not as quick as the ISAPI module, but it is very stable. In the trade-off between speed and stability, we should always favour stability for a live production server.
Installing Steps
-Create a folder called PHP on the C drive root
-Unzip the contents of the zip file you downloaded for PHP 5 into C:\PHP
-In C:\PHP, rename php.ini-dist to php.ini
-You may want to add C:\PHP onto the system path variable, as you did for MySQL in the previous section
That’s it! Now onto configuring PHP 5.
Posted by
chevrons in
PHP
After add extra field inside the Model. I get an error message when I run the application.
The error message as below:
The model backing the 'MyContext' context has changed since the database was created.
It was because the Model was different with Database field. And now, you need rebuild the Database structure again.
The solution is:
1. Open Package Manager Console from Tools -> Libraray Package Manager -> Package Manager Console
2. PM> Enable-Migrations -ContextTypeName <TheDatabaseName>
3. Set AutomaticMigrationsEnabled=true, from Migrations folder of Configuration file
4. PM> Add-Migration InitialCreate
5. PM> Update-Database
Now try run the application again. it will work fine and updated to the new Model.
Or you can use
another way to solve the problem.
Because I did delete the DB file and now I get an error message when I run the application. I expected it was the DB file was deleted by me and it didn’t help me rebuild the DB.
To solve this issue, we need stop and delete the Database with follwing step:
1. Open Package Manager Console from Tools -> Libraray Package Manager -> Package Manager Console
2. Stop local DB with command: PM > sqllocaldb.exe stop v11.0
3. and then delete it PM > sqllocaldb.exe delete v11.0
Now try run the application again. it will work fine again.
How to format
datetime value or column into a specific date format. Is the most frequently asked question by the newbie. Below table is summary of the different date formats that come from SQL Server with the
CONVERT function.
Please note that the output of these date formats are
VARCHAR data type, not DATETIME data type. With this in mind, any date comparisons performed after the DATETIME value has been formatted are using the VARCHAR value of the date and time and not its original DATETIME value.
Posted by
chevrons in
MSSQL
Jquery tablesorter is a powerful plugin for table sort and filter. It help me completed a lot of stuff.
But I found a problem, when I want filter by exact match results, the default filter function cannot do this. And I try add “
filter-match” classes to the “th” header cells. Unfortunately the results return still same.
The Solution:
To filter by exact match, you may need modify or add “
filter_functions” at the “
widgetOptions“. The example:
I found that quite a lot of people omit Internet Explorer browser, when they are doing the CSS.
For example like the custom cursor. In Firefox, Safari and Chrome, it can display property when you use
PNG image format, but it not for IE. that’s the reason why custom cursor not working on IE browser.