Thursday, June 22, 2017

c# : forcing US CultureInfo

using System.Globalization;
using System.Threading;



CultureInfo englishUSCulture = new CultureInfo("en-US");

CultureInfo.DefaultThreadCurrentCulture = englishUSCulture;

Tuesday, June 20, 2017

HOAX SMS from +639257117116

We are glad to inform you that you are ONE of our selected recipient and entitled to claim your Free Family Medical Card. Medical ref no:(UPS-050776)
kindly advice us if u are interested because we are Finalizing our record.
you may claim ur Card Today or Tomorrow from 10am to 6pm just bring 2 valid I.D and look for:
Ms. Sandra Gomez for immediate assistance 
Tel nos: 025096619 / 09167341969

Your Response is Appreciated God bless!!

Monday, June 12, 2017

Work updates : 13 June 2017

- New CTO, she's from Iran, based on Arendal, start 1st of May 2017
- Work in progress
- Support on e2 and integration
- Here or on Poland? Fast & Cost
- 15k employee support

Wednesday, April 19, 2017

BizTalk : Querying Receive Location

USE BizTalkMgmtDb
GO

-- Receive Location:
SELECT rl.Id, [Receive Location] = rl.Name, [URI] = rl.InboundTransportURL, [Receive Pipeline] = p.Name
FROM
 [dbo].adm_ReceiveLocation rl WITH(NOLOCK)
 LEFT JOIN [dbo].[bts_pipeline] p WITH(NOLOCK) ON p.Id = rl.ReceivePipelineId  
WHERE @KeyWord IS NULL OR rl.Name Like '%' + @KeyWord + '%'
ORDER BY 2
-- End of Receive Location:

PowerShell : BizTalk Error Send Email Alert.ps1

# biboyatienza - 13Jan.2017 15:59
# To Run => powershell -ExecutionPolicy Bypass -File "C:\BizTalk_Dropzone\PowerShellScripts\BizTalk Error Send Email Alert.ps1"
# biboyatienza - 19.April.2017 15:20 GMT+8 => Added detailed error:
##############################################################################
$SQLServer = "The_Server" #use Server\Instance for named SQL instances!
$SQLDBName = "IntegrationDb"
$SqlQuery = "EXEC [dbo].[usp_BizTalk_GetSuspended]"

$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server = $SQLServer; Database = $SQLDBName; Integrated Security = True"

$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection

$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd

$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)

$SqlConnection.Close()

$DataSet.Tables[0]

foreach ($row in $DataSet.Tables[0].Rows)
{
    $ApplicationName = $row[0].ToString().Trim()
    $DateSuspended = $row[1].ToString().Trim()
    $Adapter = $row[2].ToString().Trim()
    $URI = $row[3].ToString().Trim()
    $ErrorDescription = $row[4].ToString().Trim()
    $Status = $row[5].ToString().Trim()

    # Email sending:
    $From = "NoReply <no_reply@biboyatienza.com>"
    $To = "admin@biboyatienza.com", "DBA <dba@biboyatienza.com>"
    $Bcc = "biboyatienza@gmail.com"
    $Subject = "Biztalk Error : " + $ApplicationName
    $Body = "Hi BizTalk Admin(s), `r`n`r`n"
    $Body = $Body + "Application Name: " + $ApplicationName + "`r`n"
    $Body = $Body + "Date Suspended: " + $DateSuspended + "`r`n"
    $Body = $Body + "Adapter: " + $Adapter + "`r`n"
    $Body = $Body + "URI: " + $URI + "`r`n"
    $Body = $Body + "Error Description: " + $ErrorDescription + "`r`n"
    $Body = $Body + "Status: " + $Status + "`r`n"
    $Body = $Body + "`r`n`r`n`r`n br,`r`n biboy atienza"
    $SMTPServer = "mail.biboyatienza.com"
    $SMTPPort = "25"
    Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
    -Body $Body -SmtpServer $SMTPServer -port $SMTPPort
}
##############################################################################

Thursday, April 6, 2017

Introducing my new laptop at home

The Lenovo n22 n3050;


https://www.cnet.com/products/lenovo-n22-80s6-11-6-celeron-n3050-4-gb-ram-32-gb-ssd/specs/

Though it is equipped with windows 10 pro 64 bit, I still need to wipe it out and install a fresh new Ubuntu 16.04 LTS. I want to utilized it's full power. I only have 32gig disk space and Windows will surely eat it all in the long run. :(

First thing should do is to download Ubuntu installer here,



Then since I am still working on Windows environment, I need an app to create a bootable Ubuntu usb, and Rufus (Create bootable USB drives the easy way) with do that for me.



Monday, January 16, 2017

Using PowerShell to call API

Below is a sample PowerShell script that call an sms API.

# powershell -ExecutionPolicy Bypass -File "FIlename"
$yourUri = "http://gateway.yesmsfusion.no/V1/smsapi.asmx/SendSms"
Invoke-WebRequest -Uri $yourUri -Method Post -Body @{
apiKey="LJLKJL233RNL3ACLSZB3M6ZOU19K"
receipient="+639171234567"
message="Het buddy! call me when your FREE. - PowerShell"
replyPath=""
originator="Biboy"
}

Wednesday, January 11, 2017

Send email notification using PowerShell sripting when there is an Error or Warning Event

Send email notification using PowerShell scripting when there is an Error or Warning Event

1. Create a schedule task, on an Event trigger
2. Create .ps1 file that will email you
3. Enable the Schedule Task

Wednesday, November 9, 2016

C# : Create Xml files based on schema/.xsd file

- Create .xsd/schema file
- Open Visual Studio Command Prompt
- Go to the location of the schema file
- Type => xsd /classes <schema_file.xsd>
- Above command will generate a <schema_file.cs>

Wednesday, October 5, 2016

DOS Batch Command : Move 10 files out of n number of files

@echo off
REM move 250 xml files from the SOURCE folder to the DESTINATION folder.
setlocal enabledelayedexpansion
set "source=C:\BizTalk_Dropzone\zTest\Source"
set "target=C:\BizTalk_Dropzone\zTest\Destination"
set counter=0
for %%F in ("%source%\*.*") do (
 set "file=%%~nxF"
 echo move /Y "%%F" "%target%\"
 move /Y "%%F" "%target%\"
 set /a counter+=1
 if !counter! GEQ 10 goto :break
)
:break
echo Total files moved is %counter%...

Tuesday, October 4, 2016

Banco De Oro (BDO), One time password (OTP) has been compromised?

Hello BDO why do I keeps receiving One time password (OTP) even I am not logging in?
Does my account has been compromised?

The first time I received One time password (OTP) without my knowledge, I simply changed all my main password and secret password. But after a minute or two, I received again One time password (OTP) without me logging in.

Oct 03, 2016 14:44 - Reference Number: 003936
Oct 03, 2016 14:45 - Reference Number: 009056

I begin to panic, called BDO Hotline 6318000, stated my concerned and operator suggested to SUSPEND my online banking account and I agreed, and gave me a Ticket number. She said it will take 20 working days to investigate my account.

But later in the afternoon I received again One time password (OTP) with a reference number 020661 dated Oct 03, 2016 17:22, hey! BDO what the hell is happening? I do try to logging to my account to check if it was suspended and yes it is. Your account has been locked due to security reasons, please call BDO Customer Contact Center.

Today Oct 05, 2016 at around 05:47 another One time password (OTP) arrived even though my account was already being suspended. WTF!!!

Calling Banco De Oro (BDO), can you explain what is happening here?!!!

UPDATES:
Still receiving OTP even account was suspended. I am still waiting for #BDO Fraud department to contact me.

Oct 06, 2016 10:26 - Reference Number: 290171

Thursday, September 8, 2016

DOS Batch Command : Check If Any Files exists and transfer it to specific folder

@echo off

IF EXIST "C:\Payments_API\FilePay\*.txt" move /Y "C:\Payments_API\FilePay\*.txt" "C:\\SharedFolder\DDD\FilePayPay\"

Thursday, May 19, 2016

Old codes worth sharing : Simple c# class that logs to a file

A simple c# class that logs to a file.
Some of the exception formatting adopted from one of @robconery tutorial session way back years ago :)


using System;
using System.IO;

namespace Code2016
{
    [Serializable]
    internal class WriteLog
    {
        // Methods
        public static string Write(string methodName, Exception exception)
        {
            string logs = LogFormater(exception, methodName);
            WriteToLogFile(logs);
            return logs;
        }

        public static string Write(string methodName, string exception)
        {
            string logs = LogFormater(exception, methodName);
            WriteToLogFile(logs);
            return logs;
        }

        private static void WriteToLogFile(string logs)
        {
            //StreamWriter writer = new StreamWriter(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\" + DateTime.Now.ToString("ddMMyyyy") + ".log", true);
            StreamWriter writer = new StreamWriter(@"C:\BizTalk_Dropzone\Merak942\Logs\" + DateTime.Now.ToString("yyyyMMdd") + ".log", true);
            writer.WriteLine(logs);
            writer.Close();
        }

        private static string LogFormater(Exception exception, string methodName)
        {
            string content = string.Format("Date/Time: {0}{1}", DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss"), Environment.NewLine);
            content += string.Format("Method Name: {0}{1}", methodName, Environment.NewLine);
            content += string.Format("Error Details: {0}{1}", exception.Message, Environment.NewLine);
            content += string.Format("Source: {0}{1}", exception.Source, Environment.NewLine);
            content += string.Format("Stack Trace: {0}{1}{1}{1}", exception.StackTrace, Environment.NewLine);
            return content;
        }

        private static string LogFormater(string exception, string methodName)
        {
            string content = string.Format("Date/Time: {0}{1}", DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss"), Environment.NewLine);
            content += string.Format("Method Name: {0}{1}", methodName, Environment.NewLine);
            content += string.Format("Error Details: {0}{1}", exception, Environment.NewLine);
            return content;
        }
    }
}

Wednesday, March 6, 2013

Mac OSX | Installing PHP Composer under MAMP

Install MAMP:
This Assumed that you already install MAMP. If not just download and install from here.

Setup Bash Profile:
Open a terminal (Launchpad > Other > Terminal)

Biboyatienza-MacBook-Pro:~ biboyatienza$ open ~/.bash_profile


Then add/append the line below, at the time of this writing my MAMP is using php5.4.4

export PATH=/Applications/MAMP/bin/php/php5.4.4/bin:$PATH


Check PHP Setup And Install PHP Composer:
 Last login: Wed Mar 6 06:58:28 on ttys000  
 Biboyatienza-MacBook-Pro:~ biboyatienza$ php --version  
 PHP 5.4.4 (cli) (built: Jul 4 2012 17:28:56)   
 Copyright (c) 1997-2012 The PHP Group  
 Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies  
   with XCache v2.0.0, Copyright (c) 2005-2012, by mOo  
 Biboyatienza-MacBook-Pro:~ biboyatienza$ curl -s https://getcomposer.org/installer | php  
 #!/usr/bin/env php  
 All settings correct for using Composer  
 Downloading...  
 Composer successfully installed to: /Users/biboyatienza/composer.phar  
 Use it: php composer.phar  
 Biboyatienza-MacBook-Pro:~ biboyatienza$