Category Archives: PHP

Talking on Sentinal Sequential Search

This is very common to see developers writing “For” loops to search an item in an array which has entries in a “random order”. The complexity for such loops will be,

 

BEST CASE = O(1)

WORST CASE = O(n)

AVERAGE CASE = O(n/2)

 

Need to stress “Random order”?  

Yes, there is high weight on this term “Random Order”, because it’s wise to choose binary search on a sorted array 😉

Read the rest of this entry

Introduction & Rich Features on Yii Framework

Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process.

Yii Framework

Yii Framework

  1. Is it fast?
  2. Is it secure?
  3. Is it professional?
  4. Is it right for my next project?
  5. Yii Framework answer is: Yes, it is! And this how it gets its name YII.

Yii framework is built for PHP5 with performance, security and rapid deployment in mind. The framework is the brainchild of Qiang Xue, who previously developed and maintained the Prado PHP framework.

Read the rest of this entry

Use Google Spreadsheet As A Data Storage in PHP Application

Google – A most popular and efficient search engine, not just gives users the facility to get their desired search result within a few mili seconds but also offers a large range of open source products to its users. Among them, Google spreadsheet is a well known product which helps users to create their spreadsheet and store their data. It also gives a feature to share the same with other people.

For sharing there are 3 level of visibility options.

First option is “Public On The Web”, which means any one on the internet can find and access it and no sign in is required for it.

Second option is “Anyone With The Link” which means any one who has the link can access and no sign in is required for it.

The third and last option is “Specific People” which means the specified people can access the spreadsheet and a sign in is required in this scenario.

Read the rest of this entry

Re-pricing in E-commerce

What is it?

In simple words it means adjusting the price of a product on online stores.

Why Re-pricing?

When selling on online stores like Amazon, your product prices need to be competitive relative to other sellers in order to increase your chances of obtaining the Buy Box. Re-pricing tool doesn’t just lower product prices but there are many situations where re-pricing tool makes it easy to raise your product prices to increase profit and sales.

How to achieve re-pricing?

A number of sellers have begun to use re-pricing software to automatically set product prices based on what competitors are doing. There are some automated tools like Teikametrics which is used for re-pricing.

Read the rest of this entry

Orientation of the Image in PHP Application

Sometime you will get strange that you have uploaded the image on your website and the orientation of image gets changed.

Did you notice, it is the issue with the image you are uploading and is due to the Exif Data, So during uploading the image you need to change the orientation of image on server side.

First of all we should know what is Exif Data?

Exif Data:
Most people know that when you take a picture with digital camera it writes the image to a file, but quite a few people do not know that there’s usually a lot more data being written to this image file. The extra data being written is Meta data (data about data), and it may contain lots of data about the camera and surroundings when the picture was taken. This data is usually written in Exif headers.

Read the rest of this entry

Making CALL to User Mobile from Web App through Twilio Voice API

What is Twilio Voice API?

It allows developing apps that make and receive phone calls. Let’s any browser, phone or tablet talk using only a data connection.

How Twilio Voice API works?

How Twilio Voice API works?

How Twilio Voice API works?

How to Start?

It’s very to start with Twilio. Before, going to coding; first create your account in Twilio.

  1. Create account in Twilio.
  2. Get verified your mobile number.

Read the rest of this entry

JavaScript Concurrency Problem

First we should know why this Concurrency occur in JavaScript?
JavaScript is a single-threaded environment, meaning that multiple scripts cannot run at the same time. Example : Imagine a site that needs  to handle many events at the same time like UI events, query, process large amount of API data, manipulation of DOM. So, all these can’t be run due to limitation in browser’s JavaScript runtime.

For running these events we used to do the setTimeout(), setInterval(), XMLHttpRequest. All these will run asynchronously and we all know Asynchronous events will run after the current executing script has ended.

But HTML5 given us better than these hacks..
So lets have a look on these

Read the rest of this entry

Create Token URLs On PHP for Some Duration

I faced a problem in my project that in iOS Devices, if I was trying to play audio then its length and streaming was not working. For playing, I was using content-header settings to play audio in iOS Devices. But, if I was trying with direct path URL to play audio on iOS Devices then, everything was working fine. But, with my application it was not working. It’s really pain to search a lot for this. But still I have not got solution to play audio with content header settings.

But, I cannot give direct URLs path to play audio as per security issue. So, I come to know about the apache extension “mod_auth_token”.

What is mod_auth_token?
It’s an apache module that allows generating URIS for a determined time. It is very useful to handle file downloads. These generated URIs can’t be hot-linked after it expires. Various sites are using it for audio and video sharing.

Read the rest of this entry

MySQL: Varchar MySQL Joining

Often we have to join MySQL tables with CHARACTER columns. Here are some reasons where we may lag behind with the performance compared to INT fields.

With the increasing length CHAR keys performance degrade significantly. Short index values can be processed more quickly than long ones. As a result, when you index a column, ask whether it’s sufficient to index partial column values rather than complete values. This technique of indexing a column prefix can be applied to string data types.

Read the rest of this entry