How to optimize performance of liferay application

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 on localhost

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

How to detect a mobile device in jQuery and javascript?

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...

Parse String in Date Format

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 ...

Making a Text Half styled

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...

How to utilize use of count() function in php

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. ...

Using CSS in Laravel views.

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...

Horizontally center a div inside a div with css3

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...

Ubuntu enable mod rewrite in apache server

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...

Changing Placeholder Color

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...

.htaccess in Cakephp

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&#95;FILENAME} !-d...

How to shuffle an array in javascript?

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 (...

Use of Span tag

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...

Group By in Cakephp

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...

Laravel 4: how to order by using Eloquent ORM

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...

How to make custom error pages in cakephp

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( ...

How to define host and port using Laravel 4.x

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...

Send simple text mails using JavaMail API

       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 ...

How to use array_search() Function in php

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"...

How to convert a integer to binary using Javascript

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) >&...

How to make lazy load of html page contents using Javascript

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

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 ...

Show The Contact List in iOS

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...

How to Install Sublime Text on Ubuntu

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...

How to create a new gemset & copy an existing gemset into it

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 /...

How to install Rails in a particular gemset for a particular version of Ruby

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...

SETTING UP ROR FOR THE FIRST TIME ON A NEW UBUNTU SYSTEM USING RVM

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...

HTML5 - SVG

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 <...

How to create SSH connection with Filezila

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...

How to use GROUP_CONCAT in a CONCAT in mysql

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 |...

How to use api.onchange in OpenERP(Odoo)?

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...

How to use api.depends in OpenERP(Odoo)?

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...

How to fetch data from array using php ?

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...

How to get query string values in JavaScript?

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...

How to use api.model in OpenERP(Odoo)?

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...

Does MongoDB's $in clause guarantee order?

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...

How to use api.multi in OpenERP(Odoo)?

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-...

How to create a custom keyboard on android

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...

How to create a basic plugin using jquery

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. ...

How to use api returns in OpenERP(Odoo)?

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 ...

How to refresh the web page using Angular JS

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...

MongoDB Get names of all keys in collection

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...

How to query mongodb with like?

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...

Page Navigation on click of push notification

After getting push notification, if i click on that, " notification.html " page should open, now " index.html " is getting open how to achieve this ?

How to use multi Fields in OpenERP(Odoo)?

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...

How to use selection method in OpenERP(Odoo)?

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...

How to apply CSS style in CakePHP ?

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 ...

How to use search_count function in OpenERP(Odoo)

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.

How to use search_read in OpenERP(Odoo)?

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...

How to save and fetch data in local device in android .

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...
1 196 292