Saturday, June 8, 2019

Sending SMS Via SMS Service Provider in PHP

Here in India there are several service providers to send(Push) Commercial/Transactional SMS to DND/non DND mobiles. I have worked on one such module where the SMSes were being sent from our server at City Engineering College(Http://www.cityengineeringcollege.ac.in).

Here is a brief about the API Integration:

SMS sending requires you to sign up with SMS service providers in India such as Core Factors.

Now in PHP there is a way of executing or triggering a URL by the CURL command.

CURL is a way of executing a URL from within your program. The SMS that needed to be sent is encoded within the URL string and executed by the PHP program using CURL command.

There was a document from Core Factors Pvt Ltd that helped us in integrating the SMS APIs exposed by them.

Firstly to send SMS to Students/Parents mobiles we needed to login to their website and using the UI provided send bulk messages.

In the Server code that we used to send the SMSes we needed to login to the website using credentials provided by them. Then we form URL strings containing the SMS text and execute in loops the URL which sent the SMSes.

So that was the Gist of how SMSes could be sent to mobiles from a PHP Server.

Thursday, June 6, 2019

Removing Duplicates from a 2D Array in Excel VBA

The following function removes duplicates from a 2D array assuming the duplicate entries exist in first column.

It uses dictionaries.



Function RemoveDuplicatesFrom2DMatrix(arr As Variant) As Variant()
' here its assumed that key or string which is repeating is first column
Dim dict As Object

'Dim dict As Scripting.Dictionary
Dim key As Variant
Dim OutputArr() As Variant

Set dict = CreateObject("Scripting.Dictionary")

For i = LBound(arr, 1) To UBound(arr, 1)
If dict.Exists(arr(i, 0)) Then
'skip adding this row into dictionary
Else
dict.Add arr(i, 0), arr(i, 1)
End If
Next i
ReDim OutputArr(dict.Count, 2)
i = 0
For Each key In dict.Keys
    OutputArr(i, 0) = key
    OutputArr(i, 1) = dict(key)
    i = i + 1
Next key
RemoveDuplicatesFrom2DMatrix = OutputArr
End Function

Wednesday, June 5, 2019

Gantt Chart in excel VBA

If you want to make a gantt chart in excel VBA like this


which is a result of the following input


Then the various categories like A , B , C can be changed using the following gantt chart macro.

>>>>> Click Here <<<<< for the macro.