Hello Friends,
Programmer generally need last insert id for their coding requirement. If you are new in Wordpress and you need to fetch last insert id after insertion. Please follow the code below:
// Define the DB object
global $wpdb;
...
Rails provide us many features which are native to Rails and not ruby.
We can ordinalize a date in rails with a method provided by active_support known as ordinalize.
If we want to ordinalize today's date we can write :-
2.1.5 :01 > ...
In PHP, to create database in MySQL functions mysql_create_db() or mysql_query() is used. To create database using mysql mysql_create_db() syntax is as follows:
mysql_create_db($dbname);
For example:
Suppose we want to create a database...
In my recent blog about How to Improve Your Listening Skills,I have explained clearly what are the parameter by following which you can become a good listeners and will transform into a ...
With the help of Queue module we can create a new queue object that can hold a specific number of items and threads. Queue module have following method which is given below.
get(): The get() removes and returns an item from the queue.
put(): Th...
There are number of ways to get the names of the all the months in the current locale. I am using the Ruby I18n gem which comes along with Rails.
This gem provides number of methods to perform these localisation tasks.
To get the month ...
Hello Guys
ScreenName is nik name or unique identification of the user and we need to use screenname for user tagging and identify the user in liferay.
There are two ways to get screenname of current user :
Step 1: Get screenname ...
With the help of threading module we can implement locking mechanism that allows you to synchronize threads. And a new lock is created by calling the Lock() method, which returns the new lock and thread in threads module.
For example you can see...
In python Simple Mail Transfer Protocol (SMTP) is a protocol. Python provide smtplib module to handle the email system and SMTP client session object which is used to send mail to any Internet machine with an SMTP or ESMTP listener daemon along w...
This article defines an array function of PHP, which is used to find the difference between two arrays. The details of function are given below :
array_diff() : array_diff() is used to compare two or more arrays to find the difference. The fun...
If you want to implement a new thread using the threading module, you have to follow the following steps which is given below
Step-1 Define a new subclass of the Thread class.
Step-2 Override the __init__(self [,args]) method to add additional ...
In the below code I have created Menu Groups. Simply I have added menu items in menu folder, all menu item are added in group. See the below code it will clearly described how to make Menu Groups .
Step(1)-MainActivity-
public class MainAct...
Hi Readers,
If you are new to Laravel 5 you will definitely come across following terms and you will be using them without actually understanding what they stands for. But it always helpful to understand what are they stands for and why do...
Hello Friends,
If you are looking for mysql join in codelgniter. Please review the code as below:
// Initialize select query
$this->db->select('*');
$this->db->from('users');
// Define join in last parameter define left ...
What Is Path Testing ?
Path testing is a kind of structural testing approach. Path testing generally depend on the algorithm and the source code of the application. This testing does not depends on the requirements or clarifications. Path test...
Hello Guys
ScreenName is uniquely identify to user and we can use screenname as user tag name in liferay.
Here, two ways to get user by using screenname with companyId :
Step 1: Get user by using screenname in jsp(view.jsp) page...
Hi Readers,
If you are new to Laravel you will definitely come across two properties in the model one is Fillable and another one is Guarded. I myself did not get the use of these properties but once I get along I understood the actual use...
If you are looking to perform certain task on swiping on the imageView or other widgets in android (the task may be change of activity, or change of the image on imageview).
Here is the code snippet that can help you out with this.
Step 1:- ...
Hi all,
Let take you have two points, Point1 (In Boston) and Point2 (In Atlanta), Now you have to show the route between two points.
In below method , you have to pass two param's i.e.. two point of map.
- (void)displayRouteFrom:(CLLoca...
Here we will learn how to insert multiple records into MySQL Using MySQLi/PDO using the mysqli_query()/exec function in MySQLi and PDO respectively.The examples below insert two new records to the "Employee" table:
For example:
MySQLi m...
If we are required to delete a record, cakephp 's model class offers a way for the same.
Deleting the record with the perticular id can be done by using delete() function :
delete(integer $id = null, boolean $cascade = true);
The abo...
Hi all,
If you want to change the color of a polyline or route on map just change the color in this delegate of map.
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id <MKOverlay>)overlay
{
MKPolylineRen...
This object is used to perform mathematical tasks. It has various mathmatical methods. Using this object we can also create the random numbers.
1)Math.random()
Example :
<html>
<body>
<p>Math.random() returns a random n...
Hello Friends,
If you are looking to execute select query in codelgniter. Please review the code below:
// Pass the table attributes you need to fetch
$this->db->select('id, first_name, lastname');
OR
$this->db->select('*'...
Hello Everyone, today I will guide you "To Sanitize a String in PHP"
SANITIZE :- Data affirmation is usually an inclusive element of working with varieties. Not merely may be published files result in protection problems, nevertheless addition...
We pass information to a CGI program in the POST method. And post packages give the information in exactly the same way as GET methods but instead of sending it as a text string after using post. In the URL it sends it as a separate message. This...
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to removes a directory in php ?
If you want removes a directory then you should use The rmdir() function that is removes an empty directory.
The rmdir() function retu...
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to unlink a directory by using PHP ?
The unlink() function is used to deleted a file.unlink() function returns TRUE on success and FALSE on failure.
syntax of unlink(...
To get a filetype from a filename we have define a function GetFiletype() in which we have a passed a parameter i.e.,the name of the file. Using this function we will extract the '.' operator from the filename and use the extension to get filetyp...
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to check validate url in php ?
If want to check validate url in php then you can use FILTER_VALIDATE_URL.This is filter validates a URL.
you can see below example
&...
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to get the video views from youtube using API in PHP ?
If you want to see the total counts of a views on youtube video by api, then you should use below code:
<?php...
Hello Friends,
Generally we resize image after uploading. If you are looking to resize image with codelgniter. Please follow the code below:
// Include gd library
$config['image_library'] = 'gd2';
// Define your source image path
$co...
In python dis module converts byte codes to a format and You can run the disassembler from the command line and It compiles the given script and prints the disassembled byte codes to the stdout . The dis function takes a class, method, function o...
Hello Readers ,
While building a web application , several times we need a box or a div which can be draggable so below is the code for explaining that .
Example :
<!DOCTYPE html>
<head>
<link href="http://code.jqu...
Many times we need to calculate sum or product of values stored in an array. The most common way is to calculate sum or product by using for or foreach loop. For example we have an array with some numeric values, now we want to calculate the tota...
Hello Readers ,
jQuery serialize() method is used to create a text string in standard URL-encoded notation.
It is used in form controls like input, textarea, select etc.
It serializes the form values in such a way
so that its serialize...
If you are looking to create a music layer in android , here is the simple code snippet that can help you for this :-
Step 1:- Create an xml file for music player say"music_player.xml"
<RelativeLayout xmlns:android="http://schemas.andr...
In the below example I have created Display spinner in Popup Window. Here I have created a popup.xml layout. In popup layot i have added TextView, ImageView, Spinner and button. And in activity_main.xml layout I have added a button to open spinne...
The addclass() method is used to add one or more class name to the selected element.
This method is used only to add one or more class names to the class attributes not to remove the existing class attributes.
Syntax :
$(selector).addCla...
Hi All ,
These are simple steps to add card to braintree account in iOS.
1.Initialize braintree object with valid client token.
BTAPIClient *token = [[BTAPIClient alloc] initWithAuthorization:@"cleintToken received from tree"];
...
Hello Guys
Here, We can update address bar with new URL without hash or reloading the page by using javascript.
Following examples help you to better understanding :
function processAjaxData(response, urlPath){
document.getElem...
The jQuery append() method is used to insert specified content at the end of the selected elements in the jQuery collection.
Syntax :
$(selector).append(content, function(index, html))
Example :
<!DOCTYPE html>
<html&g...
While handling postback if we have pages with large data it should scrolls. So when doing that postback occurs and the position where last scroll is done gets lost by the browser.
So for doing that we can use the page property which can make t...
The jQuery attr() method is used to set or return attributes and values of the selected elements.
Syntax :
$(selector).attr(attribute)
Example:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax....
In Xamarin we have functionality to build app using C# and other Visual Studio supportive languages.
We can build apps by implementing services into it.
For using and implementing services we can use interfaces and classes that con...
Whether you are a learner or a professional coach, the one thing that matters a lot is your listening skills. As a good listeners it is always considered how effectively you listen to so...
Hello readers, In this blog I will guide you "To validate IP Address using PHP Filter Extension".
The below code validate your IP Address is valid or not using filter_var() function.
<?php
$ipAddress = "107.20.120.5";
if (...
Many of the wordpress themes are having options in admin panel for uploading and changing the favicon image. But if we want to make a custom favicon image or we do not have any option in theme then we can create a custom favicon for every wordpre...
Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to get current working directory in php ?
So basically The getcwd() function is used for returning the current working directory.
This function always returns the curre...
Mutation Testing:-
Mutation testing is a kind of structural testing approach. In this normally users utilizes the pattern of the code to conduct the testing method. In the high level, this is also a method of amendment to the source code in t...