Linux | How to grep only uncommented contents from any configuration file

Author - Navneet Kashyap

Problem : How to grep only uncommented contents from any configuration file which is big in size, has many comments and blank lines

Solution: This can be achieved by following single command :

# grep -v ‘^$’ /etc/httpd/conf/httpd.conf | grep -v ‘^ *#’ | less

Explanation of command :

^$ : Matches and removes all blank lines Read more…

Netsuite | Invalid email address or account number error on NetSuite, but passed correct credentials

Author - Neha Mishra

ERROR: Invalid email address or account number error on NetSuite, but passed correct credentials.

Need to authenticate NetSuite sandbox account through java application and fetch all the contacts. Below is the link to the WSDL file used to log in:

Click here

But on attempting the login with Read more…

MySQL | Upgrade MySQL 5.5 to 5.6 in Ubuntu 14.04

Author - Webner

MySql 5.5 is the default version for Ubuntu 14.04

Steps to Upgrade the mysql-server

If you have existing database in Mysql 5.5. It should be migrated automatically.

Take the backup of existing databases:

mysql> mysqldump –lock-all-tables -u root -p -all-databases > backup Read more…

Zoho | Create Zoho Subscription using the PHP and subscription API

Author - Webner

We can create new Zoho Subscriptions via code by using PHP curl and with the help of Subscription APIs.

Below is the sample code which is required to create a subscription:

$headerArray = array(“Content-Type: application/json;charset=UTF-8”,
“X-com-zoho-subscriptions-organizationid: 00000000”,
“Authorization: Zoho-authtoken ——–Auth Read more…

MySQL | Find if particular value is selected in multi pick list

Author - Webner

In simple pick list we can select only one value but in multi pick list we can select one or more values.

Scenario: We had to multi pick list data type field

Fields that we wanted to select :

1. Field_1
2. Field_2
3. Field_3
4. Field_4

Case 1 : Check if Read more…

PHP | Use Of strtr() function

Author - Webner

In PHP if you want to replace multiple variables of the string at one go you could use strtr() instead of using str_replace().

Example :

$vars = array(
‘##conferencelinenumber##’ =>$conferencelinenumber,
‘##pincode##’ =>$pincode,
‘##reminders##’=> ‘ ‘,
‘##name##’ =>$name,
$BODY=strtr Read more…

Moodle/ Totara | Page api to get activity details for particular activity

Author - Kritika Sood

In one of our Totara theme projects, we wanted to hide default breadcrumbs and show our own breadcrumbs on activity page like columns 1, columns 2 or columns 3. To get the activity details for a particular activity, we can write custom queries but as there were multiple activities like Read more…

Salesforce | Split function on some special characters like (.) does not work in apex

Author - Webner

Description: Using a Split function over some special characters like ‘.’ is bit ambiguous, As Apex does not recognise these characters to be part of the splitting string.

For Example: //this will fail reporting a size of 0
string s = ‘first.second’;
string[] part;
part = s.split(‘.’);
System.DEBUG(part.size Read more…

CakePHP | How to skip CakePHP authentication for some controller methods

Author - Rita

Description: By default, CakePHP authentication is applied to all application controllers. So it does not allow users to perform any of the action without login.

Solution: Each controller has a beforeFilter method which runs when some action is called from controller. Add below lines to your method:
Public function beforeFilter Read more…

Java | Delete empty string from list or array

Author - Webner

public class deleteEmptyStringQuick
public static void main(String[] args)
String[] emptyStringArray={“test”,”test1″,””,”test3″,””,”test4″};
ArrayList arrayListOfEmptyString=(ArrayList) Arrays.asList(emptyStringArray);

//normally we will do this
ArrayList filteredList = new ArrayList();
for(String string: arrayListOfEmptyString)

//You can achieve this with single line as well:
filteredList Read more…

How to handle grub rescue problem in dual boot systems

Author - Webner

Description: In a dual boot system (Ubuntu/windows), if you delete the boot partition of ubuntu or delete the Linux operating system by formatting the drive then you will face the grub rescue problem.

In this problem we have two cases:

You have deleted the boot partition of Read more…

PHP | Header function not working

Author - Webner

Code :
Function getredirect($subcontactid)

The header function in the above code does not work. But when we remove the echo from the code, it works properly.

Code after removing echo :
Function getredirect($subcontactid)
header(“location:https://subscriptions Read more…

iOS | Inconsistent Status Bar in iOS Phonegap Application

Author - Vivek Gautam

Problem : Header goes under the status bar and menu button is not clickable in Phonegap/Cordova Application.

Solution :

In the iOS version 7.0, App View covers full screen including the status bar, and the view starts from top of the screen i.e. origin(0,0); which was not Read more…

Salesforce | Change value of an object’s field on button click and reload page

Author - Webner

We can change the value of an object’s field on button click by using javascript like this (and this will also reload the page):
var rec = new sforce.SObject(“Contact”);
rec.Id = “{!Contact.Id}”;
rec.IsActive= ‘true’;
var result = sforce.connection.update Read more…

Generate getter/setter for PHP Classes in Eclipse

Author - Webner

Using PHPGen Eclipse plug-in one can automatically generate getter /setter methods for instance variables.

Note: This Plugins is not available in Eclipse Marketplace.

Steps For Installation:

Start Eclipse and add “Help> Install New Software” from following URL:

Click Add, enter http Read more…

Salesforce | How to get the User Informations like ORG_ID, User_ID etc in VisualForce code

Author - Webner

To get the active user info or org info in Visualforce code one of the best programming practice is to get the values from the controller class of the Component.

Here is sample controller class:

public with sharing class GetUserInfo
// getters and setters for the variables
Public string orgID {get Read more…

Heroku | Checkout Git project into Eclipse from Heroku

Author - Webner

1. Go to Heroku and copy the link of the specific apps that you want to take checkout of:

2. Open eclipse and start the git perspective, then click cloning icon:

3. Paste the URL link into the dialog box that appears:

4. Edit pasted url – replace protocol type i Read more…

Photoshop | Add audio to Gif animation in Photoshop

Author - Webner

Step 1. Click “Window” > “Timeline” to show the image sequence of animation.

Step 2. Go to timeline and click add audio.

Step 3. Select the desired audio you want to add in your .gif file.

Step 4. Select audio and click ok to import it.

Step 5. Adjust the audio Read more…

jQuery | Click event does not work on dynamically created HTML elements

Author - Ishpreet Kaur

Solution: Suppose we have the following HTML and jQuery code:

<div id=”container”>
<button id=”1″ class=”createNewElement”>Button</button>
alert(“Element with id ” + $(this).attr(‘id’) + ” is clicked!”); // tells id of button clicked
newElementId Read more…

Maintaining record history in database

Author - Webner

When you are building a web-based multi/single tenant system or a desktop system which has a database at its backend to maintain records, keeping the history of records proves to be very useful in the long run from information and security perspectives. History of records means keeping track Read more…

‹ Prev page1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 Next page ›