Tuesday, September 5, 2023

Mac OS PHP and XAMPP path setup

Open file dependency profile of Mac:

sudo vi ~/.zshrc or ~/.bash_profile

Now enter the following linese and save the file from your editor vi or nano:

export XAMPP_HOME=/Applications/XAMPP
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH

Now refresh the terminal and check path using the following command staying in the same terminal without closing:

exec $SHELL -l;
which php

Saturday, September 2, 2023

Set HTTP to HTTPS redirect in CWP


RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Friday, August 25, 2023

How to clear cache from Mailwizz

 /usr/bin/php -q /home/cm/public_html/apps/console/console.php clear-cache --verbose=1

Sunday, August 13, 2023

How to add Service to Autostart (CentOS 6/7)

systemctl enable httpd.service

systemctl disable httpd.service

systemctl status httpd.service

Sunday, August 6, 2023

Repeat Rows At Excel Bottom using VBA

 Sub repeatBotRows()


Dim botRows As Range, botCount As Long

Dim firstPgBk As Long, LasRow As Long

Dim totPages As Long, n As Long, m As Long


Application.ScreenUpdating = False

Application.DisplayAlerts = False

Application.Calculation = xlCalculationManual


Set botRows = Range("2:7")

Sheets("Sheet1").Copy after:=Sheets("Sheets1")

ActiveSheet.Name = "printOrig"

With ActiveSheet.PageSetup

.PrintTitleRows = "$1:$1"

End With

firstPgBk = ActiveSheet.HPageBreaks(1).Location.Row - 1

botCount = botRows.Rows.Count

LasRow = Cells.Find("*", [a1], , , xlByRows, xlPrevious).Row

totPages = Application.Ceiling(LasRow / (firstPgBk - botCount - 1), 1)

Range(Rows(firstPgBk - botCount + 1), Rows(firstPgBk)).Select

Selection.EntireRow.Insert Shift:=xlDown

botRows.Copy Range("A" & firstPgBk - botCount + 1)


n = 2

m = 0

Do

Range(Rows(firstPgBk * n - botCount - m), Rows(firstPgBk * n - m - 1)).Select

Selection.EntireRow.Insert Shift:=xlDown

botRows.Copy Range("A" & firstPgBk * n - botCount - m)

n = n + 1

m = m + 1

Loop Until n > totPages

Application.Calculation = xlCalculationAutomatic

' ActiveSheet.PrintOut

' ActiveSheet.Delete

ActiveSheet.Buttons.Delete

Application.DisplayAlerts = True

End Sub


Repeat excel rows at bottom

 Sub MyFooter()

Dim xTxt As String

Dim xAddress As String

Dim xRg As Range

Dim xCell As Range

On Error Resume Next

xAddress = ActiveWindow.RangeSelection.Address

Set xRg  = Application.InputBox("Select the row you will insert repeatedly at the bottom:", "Kutools for Excel", xAddress, , , , , 8)

If xRg Is Nothing Then Exit Sub

For Each xCell In xRg

xTxt = xTxt & xCell.Value & " "

Next

ActiveSheet.PageSetup.LeftFooter = xTxt

End Sub

Friday, July 28, 2023

Repeating Rows at the bottom of each printed excel sheet using VBA

 Sub MyFooter()

Dim StrFtr As String, Rng As Range, Sh As Worksheet, c As Range

Set Sh = Worksheets("Sheet5")

Set Rng = Sh.Range("A55:G55")


For Each c In Rng

StrFtr = StrFtr & c & " "

Next c


ActiveSheet.PageSetup.LeftFooter = StrFtr

End Sub

How to get Ranking of the Students in Excel using RANK Function

=RANK(number,ref,[order]) To rank in descending order, we will use the formula =RANK(B2,($C$5:$C$10),0) If we want unique ranks, we can use...