Hello Reader's, If you are making the code for facebook page likes details and you want to know if the user has already liked your page or not, Then you can use the following library code for that :-
<html>
<head>
<scrip...
find_in_set() is a function which returns the position of a string within second string.
We mostly found a situation where we want to fetch records on the basis of particular string and that string are stored in comma separated values in data...
In Laravel 4.x we can easily use where condition with OR AND OR .Below is the example of this
Example:
User::where(function ($query) {
$query->where('a', '=', 1)
->orWhere('b', '=', 1);
})->where(function ($query)...
Many times we need some sections of HTML which need to be incorporated in many views and just to reduce redundancy we create separate views for it.
An example to accomplish that is stated below:-
Including other views in other view synt...
Many user will make a helper in app folder but if you want to use helper the best practice and best place to use Laravel 4.x helper in app/libraries folder.
So all the basic function and helper we should define in app/libraries.
Advantage o...
Many times we needs to write static query in Laravel. Some time due to the complexity of the query or sometime due to the MYSQL build in functions not supported in the Query Builder or in Eloquent in Laravel example LPAD. Thus at that time Larave...
Hello Friends,
Sometimes we need to remove URL/Pages/Directory from indexing in Various search engine. So in this Blog we will be discussing about various method to disallow or stop major search engine from indexing search engine crawler like ...
Below is the situation which I want to solve
I have an Eloquent model which has a related model:
public function option() {
return $this->hasOne('RepairOption', 'repair_item_id');
}
public function setOptionArray...
Passing date to the function and returning the time passed or elapsed when it was commented/posted. It is very useful when you have comment section in your website and you want to show how earlier comment was posted.
/**
* Creating the dat...
Hi All,
If you want to present UIViewController in swift from storyboard . For example :- FirstViewController.swift is a viewcontroller in your Storyboard with storyboard Identifier FirstViewController then to present this viewcontroller use t...
In Laravel 4.x, We have a function by which we can run our query the syntax is
Syntax:
DB::getQueryLog()
By using this function We can run our query.
Example
$queries = DB::getQueryLog();
$last_query = end($queries);
We hav...
Hello Readers
Oops was introduced in php version 4 but the area of php version 4 is not very fast, as version 4 consists few features, hence the major concept of Oops are introduced in php version 5 which is called php5.
Oops include the b...
No separate method is provided to do search in Parse document. Following code can be used to search a column .
PFQuery *query = [PFUser query];
[query whereKey:@"username" hasPrefix:searchText.lowercaseString];
[query whereKey:@"obj...
If "Could not execute command 'lessc'" Error ocour while installing odoo-9 and the login page will not show clearly.
Then use this six command in terminal and run it one by one
1- sudo apt-get install nodejs
2- sudo apt-get install npm
3-...
In laravel we can create relation between the tables and can use them where ever we need it we need not to create custom queries or use query builder to retrieve data. I have written one of example of my worked project.
//hasOne relationsh...
Hello Reader's!, If you are looking for a code that can give the directory size from a given path, Then you can use below library code for both Windows and Linux hosting:-
If on a Windows Host:
<?
$filePath = 'c:/www/myfolder';
...
If you are looking to create zip folder on your server with terminal or putty, please follow the step below:
1) Get connected with server
ssh -i "/pemfilepath/my_server.pem" username@serverIP
2) Replace your pem file path and username ...
To save image or video into parse database, parse has provided a class PFFile. It can also be used to save documents, music files or any binary data file (upto 10 megabytes only).
To save image first convert image to NSData, assign it to PFFil...
In route in laravel we can create alias for a url. Laravel provide us the facility for giving alias for an url. We can use this url alias any where in our view
routes.php
Route::get("admin/department/{id}", ['as' => 'department.edit', 'u...
Using sort method we can sort any string, numbers, even classes either in ascending order or descending order .To sort an array ,you need to compare its element using <, >, <=, >= .
return -1 if x < y
return 0 if x = y
return ...
In Laravel 5.x we have lang class which will help us to retrieving string in different languages that will help us to easily support multiple languages.
The folder structure for /resources/lang files are
/resources
/lang
/en
...
Hi All,
To change statusBar color in any view controller, you need to follow three steps:-
First - Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file.
Second - In viewDidLoad function of your UIViewController
...
Hello Reader's you might have seen the coding standard with the common syntax | and || is used. These are the syntax used for checking the conditions and sub conditions. The first | is called as bit wise Operator. It is used to make the conditio...
If you want to delete an object from Parse DB then you have to run a query to fetch that object and then run a loop to delete it. If you already have that object then just call delete method. Here is the complete code.
PFQuery *query = [PFQuer...
The Carbon class is inherited from the PHP DateTime class.
Example:
<?php
class Carbon extends \DateTime
{
// code here
}
?>
There are n number of situation when we want to get the 1 day or 2 days old data. For this we w...
You can also get the data i.e title, description, thumbnail_url, etc from the Youtube video url by using following script. Remember you need to put the YOUR_GOOGLE_DEVELOPMENT_KEY which you can generate by creating account in Google Developer Con...
There are several posting time formats available, social sites are using their own styles of post time display. But the logic behind each posting is same, basically it depnds upon the date and time difference. Here is the function to calculate th...
Hello reader's If are using the Windows environment and developing the SSL based websites then you might have to enable the SSL for PHP for the first time. So to enable that you just need to perform the following tasks steps:-
Step1: Renam...
Hi All
To check internet connection using objective c you can use this function.
There may be a plethora of reasons that you need to check whether or not the device that is using your application has an internet connection. If checking whet...
If you want to get thumbnail image from the recorded video in iOS then you can cut a small frame from that video to generate an image. You just need to send video output URL to below method as a parameter. This method willl return you NSData. Lat...
Hello Reader's if have a html form with the variable of same name then you can get them indevisaly by POST
Change the names of your inputs:
<input name="name[]" value="Address" />
<input name="name[]" value="Number" />
<in...
This method is like a constructor of other object oriented programming languages.
when you want to initialize some class variables while creating an object, we use this method..
like any other ruby method,it starts with def keyword
class abc...
There are several properties available for MPMoviePlayerController in iOS. We just need to use them to play the movie according to our need.
You can access these properties like this:-
Create property in .h file
@property (strong, n...
Hi All,
If you need to pass data from one ViewContrlloer to other ViewController then first make properties in second ViewController in which you need that data For example:-
In SecondViewController.h
@interface SecondViewController : ...
If i want to break our loop at specific condition then it is same as other languages .
In Ruby continue doesn't work , in this there is equivalent keyword i.e next
class Number
def looping(d)
while(d!=50)
puts d
d = d + 1 ...
In Laravel two fields are auto filled or modified they are created_at and updated_at but what if your table have different named fields example created and modified in it's place they won't be auto filled or modified automatically. So to make the...
Hello Reader's! if you have an given array on with you want to sort with any selected key index as show below:-
Array
(
[0] => Array
(
[configuration_id] => 10
...
In iOS application there are only few ways to disable user interaction for the whole screen or UI. Some developers use property (User Interaction Enabled) for a specific control, some uses MBProgressHud class by displaying spinner or some uses us...
RecyclerView is works just like listview but more well organised, felexible to customize and optimize to work and in rendering the view of large data set. So in this tutorial we will see how to add items Dynamically in RecyclerView.
...
Hello Reader's! If you having a set of given url's you need just the title of them, then you can use the PHP code below to extract title
<?php
function TitleURL($YourURL){
$str = file_get_contents($YourURL);
if(strlen($str)>0)...
Migrations has very important role in Laravel 4.x. By using Migrations we can create and update our database and by using Migration we can save time because it will create schema by using single command.
Migrations Creation:
In Laravel 4.x M...
Hello Reader's!
If you have to destroy or unset the user's session automatic then the better way is to set with time dependency
session_start();
if (!isset($_SESSION['EXPIRES']) || $_SESSION['EXPIRES'] < time()+1800) {
session_destr...
Ruby is a pure object oriented language and everything in ruby is an object of some class. In ruby we can create classes and create objects of the classes. In the below example we will create 3 classes Person, Address and Company. An object of...
Recently, I faced a problem when the date was saved in different fields month, year and date. I need to club all these fields together and run a between query on it.
Another issue which was there was that Date has '0' contacted if the value ...
Use of classes and objects in ruby id different to other languages . And tell how to declare and define function in ruby and how to call the functions .
Example : In below example i am creating a program of simple arithmetic program .
class A...
.to_a is used to specify range. It is a method that converts an object into an array
Example
$, =", " # Array value separator
range1 = (1..10).to_a
range2 = ('bar'..'bat').to_a
puts "#{range1}"
puts "#{range2}"
Output
1, 2, 3,...
The main use of a pie chart is to show comparison. When items are presented on a pie chart, you can easily see which item is the most popular and which is the least popular.
you can create the pie chart in iOS by using the following methods...
Hello Friends,
NSMutableAttributedString allows to set different attributes(font size,font color) for different parts of the string.
To use NSMutableString you may use the following code:
//Create an object of NSMutableAttrinbuteString and ass...