PHPPageNo Class For Easy Page Numbering Creation



PHPPageNo Class helps you to implement page numbering in your PHP application.
This class shows Page No with links to navigate the Page’s Url.
The class constructor have four value settings that you can adjust like $startRec which represents starting record,
$totalRec is total records, $maxRecPerPage is a maximum no of records per page and $maxPageDisplay is a maximum no of page shown.
Anyway you should understand basic of OOP in PHP like constructor, class extends etc in order to get the idea of this post.

The screen shot of how PHPPageNo works is below:

Resulted Page No are also includes Prev and Next links if the total page query is more than $maxPageDisplay.
This makes the page numbering would not be shown like blown list of page no.
Continue reading

Upload file to Azure Cloud Storage Via Asp.Net Web App



Micrososft WindowsAzure is a rock solid Cloud platform that enables you automatically scales in/out your web application.
Not only scaling capabilites but also storing your files whether they are big or small in Azure Cloud Storage makes your mind free from conserning your own reliable storage on premise.
I give you basic example how to upload a file to Azure Cloud Storage via Web App using Asp.Net C#. Also to provide a link for user to download that uploaded file.

Create Storage Account or Use Local Development Storage

If you are still under development and run the web app under local PC/Laptop then you can use Development Storage.
Install necessary Azure SDK using Visual Studio 2013 or 2015 or Microsoft Web Platform Installer. After the installation done you should have Compute Emulator and Storage Emulator.
The storage emulator must be started properly before hand in order to run your Storage application in your local environment.

To access your storage you must supply Storage Connection String. Since we are using local environment then the Storage Connection String is UseDevelopmentStorage=true.
Please pay attention of it is a case sensitive.

After you finish your development and want to publish it on the cloud then you must register for Storage Account withing Azure portal and change your Storage Connection String properly in your code or configuration file.
Continue reading

Core Benefits Using Public Cloud Service Rather Than On Premise

We already introduced to Cloud Technology that leverage Virtualization to minimize physical Servers cost.
Technically, there are some schemes in Cloud which are Public Cloud, Private and Hybrid. Private Cloud has its own Data center, virtualization & infrastructure on premise whereas Public cloud are over the Internet.
On the other hand, Hybrid Cloud is in between your on premise and public cloud. Hybrid used to integrate existing On premise With public cloud features.
This blog focus on Public cloud pros and cons.

Public cloud itself devided into three categories which are Infrastructure as a Service (IaaS), Platform as a Service (Paas) and Software as a Service (SaaS).
Example of IaaS are Virtual Machine as a Server, Virtual Network, Cloud Storage etc. PaaS are Scalable Web App Hosting, Database as a Service etc.
SaaS are GMail, GDrive, Office 365, One Drive, Amazon Document Sharing, Drop box etc.
There are three major companies provide Public Cloud services: Microsoft Azure, Amazon Web Service and Google Cloud.
Below are pros and cons using Public cloud for your organization.


  1. Up time guarantee. Your application, data, servers, virtual networks are inside Data Centers and its Infrastructure provided by those great companies.
    Your account include SLA that guaranteed the system will be online 24/7 for a whole year. Ensuring reliability and availability is important and the most important thing is to make us having Peace of Mind
  2. Your Application and Servers are Available over the Internet with secure access Control.
    You can access your system anywhere but if you want to limit by specific IP range surely you can.
  3. Continue reading

Calling iSeries (AS/400) Commmand Using Visual Basic.NET

This blog post demonstrate on how to run iSeries Command using VB.Net. This is needed for example to change user ID password via an application.
Schedule Task also might be used it to perform some jobs that have conditional things or validation.

In order to run AS/400 Command via Visual Basic,you need a pre-requisite. You have to install IBM iSeries Client Access and make reference to IBM.Data.DB2.iSeries.dll in your application.
In my computer the library is located in C:\Program Files\IBM\Client Access folder.

Basically to call AS/400 Command, you will use ADO.Net objects and execute QSYS.QCMDEXEC syntax.
For example, if you have a program called MYPGM that you want to execute, you could send this SQL statement to the AS/400:
Note: The second parameter must contain exactly 15 digits: ten to the left of the decimal and five to the right.
You can write a program to count the length of the command and create the second parameter for you
Continue reading

PHP Adapter Design Pattern Example

This post contains two examples of Adapter Design Pattern using PHP. I am giving these examples in order to understand more comprehend about Adapter Pattern.

First, implementation of Adapter Design Pattern statement
Convert the interface of a class into another interface clients expect.
Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
Adapters are helpful if you want to use a class that doesn’t have quite the exact methods you need.

Second, implementation of using legacy class and you can’t change that legacy class but you want to port its method to another needful method.

First Example

An example class ‘clsProducts’ methods can be used inside many Adapter class to returns another result.
clsProducts object instance is passed as Adapter classes constructor argument and clsProducts methods are being used inside those Adapter classes.
Continue reading

Fast Displaying Large CSV File, Filter And Save Filtered Data Using SQLite & Java

SQLite CSV file often used for download or upload data from/to database. If table’s records count is large or very large then downloaded data to CSV file will have large in size.
Opening that large CSV file using spreadsheet application requires a lot of memory and CPU resources. Depending on user computer specifications, some consume much time to open.

It is much faster using Notepad++ to open large CSV file but if we want to filter data and save it to another CSV then using Notepad++ will not be efficient especially for some complex filtering criteria.

==> The workaround of this situation is to import that large CSV to SQLite. After importing to SQLite, we can filter it using SQL Query and save it back to CSV file.

According to documentation, SQLite is an embedded SQL database engine. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file.
Think of SQLite not as a replacement for Oracle but as a replacement for fopen(). Its performance is usually quite good even in low-memory environments.

This blog post gives example on basic connection to SQLite, Sql Query, importing CSV, save query to CSV. Also example on using SQLite in Java so you can build your own application.
Continue reading

Easy Creating Or Convert To PDF File Programmatically Using PHP mPDF

We can create PDF file using PHP easily. I choose mPDF in order to do this. Why mPDF ? That because the method is to use html string for writing PDF content and then produce PDF as an output.
We can format PDF content like an HTML page i.e using bold <b/>, table <table/>, etc which is easy for Web developer off course.

PHP.Net has own recommended PDF creation class which are Haru PDF and PDFLib. They are great but many lines and methods to do simple ‘Hello World’ example. I feel easier using mPDF since it uses HTML string.

This blog post will demonstrate how to install and gives some basic examples so reader can have brief ideas how to create PDF programmatically.

Download & Install MPDF

Download PHP source code of MPDF from
Copy to a folder in your web server directory. I am using MPDF57 for this demonstration.
Continue reading