Hello guys
I am writing blog to improve performance of liferay web application. Liferay provide some portal properties to improve application performance.
Put below properties in portal-ext.properties file in application server.
javascri...
enable https in localhost
For OS Ubuntu
sudo a2enmod ssl
service apache2 restart
-- If this doesn't work try this
sudo a2ensite default-ssl
service apache2 reload
Now hit your localhost
https/localhost
Using jQuery you can use the following code:
$.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
This will return "device" for all devices.
You can use the belo...
In order to parse the String in date, first of all you need to check in which date format the String is coming.
Then we will define date pattern accordingly.
Following steps will guide you how to parse String in Date:-
Step 1
Understand the ...
The advanced CSS rules that allow styling each half or third of a character, vertically or horizontally, independently and individually.
Works on any dynamic text, or a single character, and is all automated. All you need to do is add a class on...
what is count() function
The count() is utilize to count all data elements in an array, or in other word we can say The count() function returns the number of elements in an array.
You can see below example of count() function.
...
CSS plays an important role in every project. In Laravel 4.x we will define our css in:
public/css/custom.css
Here In above path we will define our css in laravel 4.x
To call a view from controller we will use the code as follow:
Ex...
Box-pack
The box-pack property specifies where child elements of the box are placed when the box is larger than the size of the children. It specifies the vertical position in vertical boxes, and the horizontal position in horizontal boxes.
B...
Go to this directory.
etc/apache2/apache2.conf
you will find below code with AllowOverride none.
<Directory />
Options FollowSymLinks
AllowOverride none
Require all denied
</Directory>
<Directory /usr/sh...
WebKit, Blink (Safari, Google Chrome, Opera 15+) and Microsoft Edge are using a pseudo-element: ex- ::-webkit-input-placeholder.
Mozilla Firefox 4 to 18 is using a pseudo-class: :-moz-placeholder (one colon). ex- :-moz-placeholder
Mozilla F...
Without .htaccess file in cakephp your application will not run.
There are 3 different .htaccess files:
/var/www/app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d...
To shuffle(randomize) an array in javascript, there is an algorithm called Fisher-Yates devised and Don Knuth popularized algorithm.
Below is the code for using it:-
Array.prototype.shuffle = function() {
var input = this;
for (...
Span tag plays a very important role in HTML, CSS designing.It is used to provide beautiful,attracting,as desired features to the attributes using CSS.
SPAN tag is a tag using which attributes can be implemented.
There many tags but we m...
The GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns.
Below is the possible keys that we use in cakephp query.
$params =
array(
'conditions' => array...
In Laravel 4.x we have many facility to use query in a easy way. We will also run raw query in laravel 4.x. Laravel 4.x also provide of using order by query using Eloquent ORM.
We can easily understand this by seeing the example of order by...
Hello Readers ,
If any one enters the wrong URL then how to show our custom error page , follow the below code.
Exception render need to set as an AppExceptionRender.
/app/Config/core.php
Configure::write('Exception', array(
...
Now a days there are n number of website which will move to android. So for every application we have to make API. If we will make our API in laravel 4.x then we will test using Postman. To define our port and to run our API using "Postman" we ha...
You can build build mail and messaging applications with the help of JavaMail API, which gives you access to a platform-independent and protocol-independent framework. You can use the JavaMail API as an ...
what is array search ?
Array search returns the corresponding key if search is successful and Searches the array for a given value.
You can take reference form below example.
<?php
//firstly create a array
$employeName=array("1"...
Hello, If you need to convert the interger to binary then by using Javasript you can perform it very fast, Let see the example below:-
var binary = (56 >>> 0).toString(2);
console.log(binary);
console.log(parseInt(binary, 2) >&...
Hello Reader's!
If you are looking to make your website pages more dynamic and light that loads the html sections as user scrolls down, Then you can use the code below:-
First thing is to make some corrections on the html page like. you need...
Ruby Methods are similar to functions which begins with lowercase letters. It bundles one or more repeatable statements into single units.Methods are always defined before calling them.
Syntax:
def method_name [( [arg [= default]]...[, * arg ...
To show the list of contact in iPhone use the code Below:
1- import the ContactsUI framwork in viewController
2- Confrom the ViewController to the CNContactPickerDelegate
3- call the delegate method func contactPicker(picker: CNContactPicke...
Sublime Text can be installed either via the ubuntu software center or via the teminal by downloading it from the repository.
Here i am going to tell you how to download Sublime text 3 from a terminal.
1> We can install Sublime Text Edi...
We can create a new gemset to install a specific set of gems in it. In this i am copying an existing gemset into a newly created gemset.
1> To list the available gemsets we can type :
rvm gemset list
gemsets for ruby-2.2.3 (found in /...
1> For this we should first confirm the ruby version we are currently on
rvm current
(ruby-2.2.3)
2> To view the list of available gemsets before selecting a particular gemset, we can type
rvm gemset list
gemsets for...
1> We need to install RVM before we can install Ruby, because RVM is a version manager and it will help us to install & manage different versions of Ruby on the same system and easily switch between them.
To install RVM we first need to...
SVG is used for graphs like Pie charts, 2D graphs in X,Y coordinate system. It stands for Scalable Vector Graphics and it is a method for describing graphics in xml and then xml is rendered by SVG viewer.
Using SVG in HTML5:We can use SVG by <...
If you are looking to create secure ssh connection in filezila with .ppk file. Please follow the below instruction:
1) Open your filezila.
2) On the top menu bar please click at Edit --> Setting
3) Now a pop up will appear. On the right s...
GROUP_CONCAT will always return a string value . It can be easily explain by the example.
Example:
bookid | bookname | isbnno | cateid | autid | pubid
| BK001 | Introduction to Electrodynamics | 0000979001 |...
Api.onchange will trigger the call to the decorated function if any of the fields specified in the decorator is changed in the form:
In below code you can use in your .py file.
@api.onchange('fieldx')
def do_stuff(self):
if self.fieldx == x...
Api.depends will trigger the call to the decorated function if any of the fields specified in the decorator is altered by ORM or changed in the form:
In below code you can use in your .py file.
@api.depends('name', 'an_other_field')
def afun...
You can take reference form below example to fetch data from array list using php.
This method is really very easy.
<?php
// you have to Decode the array and store a variable
$GetRecord = json_decode('[{"Name":"Mac","age":"25"},{"Na...
A query string is an optional part of a URL that goes after the file name and begins with a question mark (?). For example, the following URL has a query string ?quryEg after the HTML file name:
http://www.findnerd.com/file.html?quryEg
Here...
Api.model will convert old API calls to decorated function to new API signature. It allows to be polite when
migrating code.
The below code you can use in your .py file .
@api.model
def afun(self):
pass
Note- Model.api will automaticall...
Hello All,
In this blog we will discuss whether MongoDB's $in clause guarantee order or not.
The $in operator selects the documents where the value of a field equals any value in the specified array. To specify an $in expression, use the fo...
With the help of multi api we will be able to set the current RecordSet without iteration. It is the default behavior.
In below code i have used search_read function to set the current RecordSet
@api.multi
def afun(self):
len(self)
Note-...
If you are interested in making your own Soft Keyboard in android, then this tutorial will be helpful for you. Below are few steps to learn how to create your own Soft Keyboard that can serve as your own default keyboard.
Step1: To enter a tex...
If you want to make a functionality that can be used anywhere in the code. For example, you want some method that can be called on the jquery selection and it can perform number of operations on the selection. For this, you can write a plugin.
...
Api unity of returned value will return a RecordSet of specified model based on original
returned value:
In below code i have explain api_returns
@api.returns('res.partner')
def afun(self):
...
return x # a RecordSet
Note- And if an ...
Hello Reader's if you need to refresh the webpage using the Javascript then Angular js offers you many ways but you can use the best and the shorted way , as below:-
var PageLandURL = "http://www.abc.com"; //Just set ur URL
$window.location.h...
Hello All,
In this blog we will discuss about how to get all keys in mongoDb collection.
Sometimes we are in a situation in which we want only the keys not the data itself from the collection.
So as a result you can try by following belo...
Hello All,
In this blog we will discuss about how to query mongodb with "like".
In MySql you might have normally used below code to find by like
select * from users where name like '%text%'
But for using like in mongoDb you have t...
The multi function is used to compute multiple values.
In below code i have used api.multi to compute multiple values
@api.multi
@api.depends('field.relation', 'an_otherfield.relation')
def _amount(self):
for x in self:
x.total = an_algo...
Its indicate no selection constraint in database. Selection must be
set as a list of tuples or a callable that returns a list of tuples
In below code i have explain search_read
aselection = fields.Selection([('a', 'A')])
aselection = fields...
To apply a CSS Class to a form generated by the Form Helper in CakePHP see the example below
1. To add a class to a form tag:
echo $this->Form->create('User', array('class'=>'form'))
2. To add a class to a input tag:
echo ...
In the search_count function returns the count of results matching search domain:
In below code i have explain search_read
self.search_count([('is_company', '=', True)])
Note -with the help of this code we retrieve all adress.
A search_read function is now available. It will do a search and return a list of dict.
In below code i have explain search_read
self.search_read([], ['name'])
[{'id': 3, 'name': u'Administrator'},
{'id': 7, 'name': u'Agrolait'},
{'id': 43...
Here I have created save data item and fetch data Item from local server. In below code first I have created DatabaseSave class and craeted database like Caller name ,CallerDetails,CallNumber etc.
After defining database class I have created tab...