Gregory Varghese
  • About Me
  • Labs
  • GitHub
  • My Work Setup
  • My Photography Blog
  • About Me
  • Labs
  • GitHub
  • My Work Setup
  • My Photography Blog
  • Categories
  • All
  • Solutions
  • Administration
  • Troubleshooting
  • Tips and Tricks
  • Development
2nd February 2020
AdministrationBitbucketDevelopmentPipelinesTips and TricksTools

How to execute SSH command with Bitbucket Pipelines

I inherited an old site that someone else setup that is just a basic static HTML, which was deployed using a git pull on the server. I wanted to automate the deployment, and instead of using rsync as the site will be re-built, I realized I could just configure the Bitbucket Pipeline to use SSH and run the pull command. This is probably a fringe case but here’s the bitbucket-pipelines.yml in case anyone finds it useful.

Add the repository variables for $USER, $SERVER, and $FOLDER with the appropriate values and then you should be able to run the deployment.

pipelines:
  default:
    - step:
        script:
          - pipe: atlassian/ssh-run:0.2.8
            variables:
              SSH_USER: '$USER'
              MODE: 'command'
              SERVER: '$SERVER'
              COMMAND: 'cd $FOLDER && git pull'
  • Continue Reading
  • 0
  • 173
10th September 2019
AdministrationDevelopmentMicrosoft WordProgrammingSolutionsTips and TricksVBAWord

How to Generate a Page for Each Day of Month in Microsoft Word using VBA

I briefly joined my wife at her practice to help her grow the business and figure out how to make things more efficient. One of the things I learned is that my wife created a sign-in sheet for the office in Microsoft Word. Every week she would open the file and manually enter the date for each day of the week and then print out the documents. I took over the responsibility for a month and it annoyed me due to how inefficient the process was and I decided to automate the entire thing. I couldn’t find a solution to the problem online so I had to roll my own and am sharing the code in case someone else can benefit from it.

Important Details

The script will calculate the first day and last day of the month and then do a loop to append the date in the “Day, Month day, Year” format (i.e. Thursday July 17, 2019) to a text field.

There are a few important steps involved to get the script working as is:

  1. Create a Word doc with the first page that you want to duplicate.
  2. Add a text field from the developer tab. To copy and paste the code below as-is, you’ll need to name it txtDate. This is where the date will be added. If you want a different field name, change the name at line 26 and 83. You can also change the date formats to suit your needs here as well.
  3. Add a second blank page to the document. I was running into issues where the paste was appearing partially on the first. The blank page resolved this and I added code to remove the original page as well as the blank one from the beginning.

How to Use

Open up Word, then open up VBA, and copy and paste this snippet into a module. When you run the function, it’ll create a copy for every day of the month. I also created a function to start at a specific date in case you run it in the middle of the month.

Sub CreateSigninsForMonth()
    Dim N As Integer
    Dim sCurrentMonth, sCurrentYear As String
    Dim sNewDate As String
    
    N = 1

    Count = Day(GetLastDayOfMonth)
           
    For CopyNumber = 1 To Count
    
        With Selection
            .GoTo wdGoToPage, wdGoToAbsolute, 1
            .Bookmarks("\Page").Range.Copy
            .Paste
        End With
    
        With ActiveSheet
       
         sCurrentMonth = Format(Date, "mmmm")
         sCurrentYear = Format(Date, "yyyy")
         sNewDate = (CopyNumber & " " & sCurrentMonth & " " & sCurrentYear)
        
        ActiveDocument.FormFields("txtDate").Result = Format(sNewDate, "DDDD MMMM dd, YYYY")
          
        End With
        N = N + 1
    Next CopyNumber
    
    'Delete template + blank page
    For i = 1 To 2
    With ActiveDocument
        strt = .GoTo(wdGoToPage, wdGoToLast).Start
        Set r = .Range(strt - 1, .Range.End)
        r.Delete
    End With
    Next

End Sub

Sub CreateSigninsForMonthStartingDate()
    Dim Count As Integer
    Dim N As Integer
    Dim sCurrentMonth, sCurrentYear As String
    Dim sNewDate, sEndDay As String
    
    N = 1
    Count = 0

    iStartDay = InputBox("Which day do you want to start on?", "Starting Day", "1")
    Count = InputBox("Which day do you want to end on?", "Ending Day", Day(GetLastDayOfMonth))
    
    Do While Count > Day(GetLastDayOfMonth)
        sEndDay = InputBox("Which day do you want to end on?", "Ending Day", Day(GetLastDayOfMonth))
                    
        If iStartDay = vbNullString Or sEndDay = vbNullString Then
            MsgBox "You clicked cancel.", vbOKOnly, "Try again later!"
            Exit Sub
        End If
           
        If IsNumeric(CInt(sEndDay)) Then
            Count = CInt(sEndDay)
        End If
    Loop
    
    For CopyNumber = iStartDay To Count
    
        With Selection
            .GoTo wdGoToPage, wdGoToAbsolute, 1
            .Bookmarks("\Page").Range.Copy
            .Paste
        End With
    
        With ActiveSheet
       
         sCurrentMonth = Format(Date, "mmmm")
         sCurrentYear = Format(Date, "yyyy")
         sNewDate = (CopyNumber & " " & sCurrentMonth & " " & sCurrentYear)
        
        ActiveDocument.FormFields("txtDate").Result = Format(sNewDate, "DDDD MMMM dd, YYYY")
          
        End With
        N = N + 1
    Next CopyNumber
    
    'Delete template + blank page
    For i = 1 To 2
    With ActiveDocument
        strt = .GoTo(wdGoToPage, wdGoToLast).Start
        Set r = .Range(strt - 1, .Range.End)
        r.Delete
    End With
    Next

End Sub

Function GetFirstDayOfMonth(Optional dtmDate As Date = 0) As Date
    
    ' Return the first day in the specified month.
    If dtmDate = 0 Then
        ' Use the current date if none was specified
        dtmDate = Date
    End If
    
    GetFirstDayOfMonth = DateSerial(Year(dtmDate), Month(dtmDate), 1)

End Function

Function GetLastDayOfMonth(Optional dtmDate As Date = 0) As Date
    
    ' Return the last day in the specified month.
    If dtmDate = 0 Then
        
         ' Use the current date if none was specified
        dtmDate = Date
    
    End If
    
    GetLastDayOfMonth = DateSerial(Year(dtmDate), Month(dtmDate) + 1, 0)
End Function
  • Continue Reading
  • 0
  • 219
22nd August 2019
AdministrationCloudflareNamecheapReview

Why I’m switching from Namecheap to Cloudflare

Years ago, when the internet was young, I purchased my first domain from InterNIC for about $70 a year. When the alternatives finally popped up, I switched my domain to Godaddy. As prices dropped, I ended up buying more domains through them for ideas and projects I developed. Eventually, I got tired of Godaddy’s shenanigans with pricing (increasing prices and having privacy as an add-on) and upselling everything, and after reviewing many technical forums, ended up switched everything to Namecheap where I even signed up for their shared hosting.

Things started well, but after a short while, the hosting ended up not being any better than Godaddy as all my sites became ridiculously slow as they oversold capacity. I finally made the jump to DigitalOcean, and the same site without any changes or optimizations jumped in performance about 60% based on the metrics reports I was running. No joke, people were pinging me asking what I changed to make my site run so much faster because they wanted to do the same.

I was annoyed that Namecheap refused to refund a partial credit on the hosting even though I wasn’t using it anymore despite their bait and switch caused the performance issues by overselling capacity. In the end, I didn’t fight, because it was cheap, I was beyond the credit card chargeback period, and I still had domains with them and didn’t like any of the other registrars out there enough (nor were the prices better) to make the switch.

On the domain side, their control panel was pretty confusing at first. Godaddy’s was more straight forward for managing DNS and records, so I had to constantly figure out what the Namecheap configuration equivalents were because it wasn’t straight forward. They updated their control panel, and things got easier, but it still wasn’t intuitive. I think a lot of my confusion came from them trying to default to their parking pages or their hosting.

I’d run into issues, and their support would always be good enough to help fix them. I then ran into an issue with setting up a txt record. The fix required them to manually enter the entry on their side due to a bug in their control panel that they still haven’t fixed to date. The bug was serious enough that if I made any changes to any of the domain settings (like adding another A/CNAME/MX record), it would undo their change and I’d have to file another ticket for them to complete the change.

All changes would take hours to propagate. Many of the services that validate DNS changes would not see them for hours or even a day. It hadn’t been a great experience, and now I’ve wanted to find a new registrar to replace Namecheap.

In 2018, CloudFlare announced their registrar service. I’ve patiently watched to see how reliable it is and finally ended up testing it last month with a domain for an existing project that’s in development. To say I was blown away was an understatement. The experience hasn’t been perfect, but the things that really matter are well executed.

I found Namecheap to be a bit deceptive in the transfer process. All other registrars I’ve used let you approve transfers instantly via a link in the notification email. Namecheap sent an email saying they received a request to transfer the domain and this is the text about approving/canceling:

I wanted to expedite the transfer only because I wanted to get the control panel cleared out to find out what’s left and what’s worth keeping and what domains I should let go. I reached out to their chat and learned that they implemented a dark pattern. I never clicked the link because I didn’t want to accidentally cancel an approved transfer as I had assumed it was a direct link to cancel.

It turns out that their support person confirmed the text is deceptive and the link opens a page lets you approve or cancel it:

Not cool Namecheap, but I digress. So let’s look at the pro’s and con’s of CloudFlare which elaborate why I’m switching to them.

Pros

  • Price point is cheaper than everyone else since they sell wholesale.
  • Transfers are painless.
  • Control Panel is intuitive compared to both Namecheap and Godaddy’s. It allows for managing records quicker.
  • DNS changes reflect instantly on all the third party domain verification services.
  • Cloudflare offers free SSL on the domain level.
  • Support responded in a few hours to an issue I had.

Cons

  • Can’t register new domains directly at Cloudflare which requires purchasing a domain somewhere else and then waiting 60 days to transfer.
  • Doesn’t support all the TLD domains yet.
  • Can’t create custom nameservers without paying $200 a month, which was free with godaddy and namecheap.

Not bad for a cons list, so I migrated most of my domains over to Cloudflare, and it’s a win all the way around. They sell domains at cost, offer a ridiculously easy to use control panel where everything works. Even better are how quickly changes take effect, and third party services can validate the changes.

  • Continue Reading
  • 2
  • 198
8th August 2019
AdministrationDroboHardwareProductsReviews

Why the Drobopro-FS Pro sucks

A few years ago, I purchased a DroboPro-FS Pro 8 bay NAS system. After getting a demo from one of my vendors, I was sold on the ability to have different sized hard drives, hot swapping, and the self repairing file system. Another feature I liked was that it also monitors the health of my hard drives. If one starts developing issues or gets full,  Drobo will warn me, and robotically shift my data to other drives until I can replace that drive. I did my research and at the time, it looked like a fantastic deal.

After a few years with it, I can readily admit I made a huge mistake in purchasing the product. I’m lucky in that the unit has not failed yet like it has for others but it’s also a horrible choice for backups for a myriad of reasons.

  1. IT LOSES DATA: My Drobo mysteriously loses data after it reboots. I’ve noticed this a few times after I’ve come home from vacation and turned off the unit to save power. Files (entire gigs of them) I haven’t accessed in months are mysteriously gone. Because it’s a custom file system, I have no way of trying to recover anything. I’ve confirmed this actually happens by running a disk catalog before shutting down and then running a report on the compare which shows files are definitely missing. I’ve done this 4 times and have verified it happened 4 times now. Missing file range from a few to hundreds and they vary in size so there’s no discernable pattern.
  2. Vendor Lock-in: You can’t access any of the files without a Drobo due to the custom file system. If the unit fails, you lose everything unless you buy another unit. 
  3. Terrible Support: Support is lackluster. The warranty is one year and then you’re on your own which is not exactly confidence building. 
  4. Weird Custom Desktop App: The Drobo dashboard is terrible and should have been a web interface like the other NAS options on the market. The dashboard is an app that runs in the background to connect to the shares and manage permissions, which every OS can do natively. Even worse, the dashboard app supposedly connects to the Drobo through port 5000 and then broadcasts over a randomized port which requires custom firewall permissions if it doesn’t support app level permissions. There’s no reason for the app to exist let alone broadcast anything.
  5. Doesn’t Deliver on Core Features: One of the features of the Drobo that sold me on it was that it should notify you when a drive is failing. In reality, the Drobo did not actually notify me about failing drives until it was too late and the drive failed completely and it didn’t move any of the data to other drives.
  6. Apps: Non-existent. They released some basic app support by doing a weird workaround by creating a directory and adding the app files to it but then it suddenly disappeared from the Drobo website. A third party site came up to mirror the lost apps but at this point it’s not even worth the effort to me. Droboapps was an extremely limited offering and afterthought. They actually removed support for apps from the Drobo because they didn’t want to deal with supporting users.
  7. Remote File Access – Doesn’t exist natively.

Compared to Synology DS1918+

I purchased a Synology DS1918+ 8-Bay Drive and the differences are pretty stark. I’ve actually been moving important files from my Drobo over to it as a safeguard.

  • No data loss: Thus far, no data has been lost on the Synology.
  • Apps: The apps support on Synology is incredible. I use a bunch (Plex, Photos, Backups, and many others) but the one I love most is Synology Drive, which works as a replacement for DropBox.
  • Web Interface: The Synology web interface is extremely intuitive and easy to work with. There’s options for power users to make the NAS even more useful. I love that there’s no custom app to run in the background on my desktop. Connecting to shares is as simple as using the network shares native to the OS.
  • Permissions/Security: The Synology permissions can be extremely granular, and includes support for roles/groups + users.
  • Sharing: Synology offers an easy way to share files over the internet with permissions, like Dropbox does. The only difference is you aren’t limited to file size restrictions. Drobo does not.
  • Remote Connect: Synology offers a browser based remote connect solution they call Quick Connect. Once you configure your Synology for remote access (it even configured my firewall permissions), you can access it via the quickconnect URL. No jumping through hoops for setup or access, and it just works. Good luck with setting this up with the Drobo, as I haven’t figured it out.
  • Continue Reading
  • 0
  • 161
6th August 2019
DevelopmentLaravelMacMAMPPHPPHPStormPHPStormSolutionsTips and TricksTroubleshooting

How to Get Laravel Debugging to work with PHPStorm and MAMP Pro 5

This has been one of the more aggravating things I’ve had to deal with in setting up software for development. I’ve followed the official documentation from JetBrains, over 30 other blog tutorials, and literally failed in getting any of them to work.

I figured out an easy way to make the setup work so I’m sharing it in case someone else finds it useful and for self-reference since I’ll probably forget how to do this again in 6 months when I start a new project.

MAMP Configuration

  1. Load MAMP and setup your host. Make note of the host name as you will need it to configure PHPStorm.
  2. Go to PHP on the left under Languages.
  3. On the right under Extensions, check Xdebug (Debugger).
Screenshot of Steps 1-3

PHPStorm Configuration

  1. Load PHPStorm and load your Laravel project.
  2. Setup your PHP executable and interpreter as per the official documentation and then resume here.
  3. On the top right of PHPStorm, select Edit Configurations from the dropdown.
    PHPStorm Dropdown
  4. Click on the Plus Button on the top left of the dialog and then select ‘PHP Web Page’.
    2 phpstorm debug configuration
  5. Enter a descriptive name in the textbox. I use the host name from MAMP so it’s easy to identify visually. Click on the 3 dots with next to Server.
    3 phpstorm debug configuration
  6. Enter a descriptive name. I use the host name here as well. For the host, omit the http/https and just add the host name from MAMP.
    4 phpstorm debug configuration
  7. Click OK
  8. Now add your breakpoints and click on the Debugger Button on the top right and PHPStorm will load the site into the browser and break when breakpoints are hit.
    5 phpstorm debugger

Happy debugging!

  • Continue Reading
  • 2
  • 187
9th July 2019
ApplicationsC#c#DevelopmentOutlookProgrammingSoftwareWindows

How to Automate Sending Emails through Outlook interop using C#

I was tasked with a tricky issue in sending emails. Due to security concerns, the client’s IT team was not willing to share SMTP information for their mail settings and was only willing to set up an account in Outlook directly on a dedicated machine without sharing the password with us to send the emails. The client’s ask was to send emails through Outlook without letting users see the emails or Outlook itself.

Installing Office Interop for Outlook

Sending emails through Outlook can be done using Microsoft.Office.Interop.Outlook but the documentation is really lacking. If you need to do the same, I hope this will save you the hours of time it took me to figure out what ends up not being complex code.

Create a new desktop application project in Visual Studio. Install the Microsoft Office Interop for Outlook. I used the NuGet package manager to install it since it wasn’t present on my system:

Install-Package Microsoft.Office.Interop.Outlook

Automating E-mails using C#

I created a static class to send the email through Outlook. Note that my error handling code was replaced with Debug.Writeline. Remember to modify it to handle errors or implement logging so it doesn’t fail silently.

Email.cs:

using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Office.Interop.Outlook;
using Exception = System.Exception;

namespace Email.classes
{
    public class Email
    {
        public static void SendWithEmbeddedImages(string to, string subject, string htmlMessage)
        {
            var missing = Type.Missing;

            Application oOutlook = null;
            NameSpace oNS = null;
            Folder oCtFolder = null;
            Items oCts = null;
            MailItem msg = null;


            var sHeaderPath = Path.Combine(Environment.CurrentDirectory, "emails", "header.jpg");
            var sLogoPath = Path.Combine(Environment.CurrentDirectory, "emails", "logo.jpg");

            try
            {
                // Create an Outlook application.
                oOutlook = new Application();

                // Get the namespace.
                oNS = oOutlook.GetNamespace("MAPI");

                //Assumes MAPI profile name is Outlook
                oNS.Logon("Outlook", missing, false, true);
                msg = (MailItem) oOutlook.CreateItem(OlItemType.olMailItem);

                var attachHeader = msg.Attachments.Add(sHeaderPath, OlAttachmentType.olEmbeddeditem);
                var attachLogo = msg.Attachments.Add(sLogoPath, OlAttachmentType.olEmbeddeditem);

                attachLogo.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", "logo");
                attachHeader.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E",
                    "header");

                msg.Subject = subject;
                msg.To = to;

                msg.BodyFormat = OlBodyFormat.olFormatHTML;
                msg.HTMLBody = htmlMessage;

                //Show email
                msg.Display();

                //Send email
                //((Outlook._MailItem)msg).Send();

                oNS.Logoff();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Automate Outlook throws the error: {0}", ex.Message);
            }
            finally
            {
                // Manually clean up the explicit unmanaged Outlook COM resources by  
                // calling Marshal.FinalReleaseComObject on all accessor objects. 
                // See http://support.microsoft.com/kb/317109.

                if (msg != null)
                {
                    Marshal.FinalReleaseComObject(msg);
                    msg = null;
                }
                if (oCts != null)
                {
                    Marshal.FinalReleaseComObject(oCts);
                    oCts = null;
                }
                if (oCtFolder != null)
                {
                    Marshal.FinalReleaseComObject(oCtFolder);
                    oCtFolder = null;
                }
                if (oNS != null)
                {
                    Marshal.FinalReleaseComObject(oNS);
                    oNS = null;
                }
                if (oOutlook != null)
                {
                    Marshal.FinalReleaseComObject(oOutlook);
                    oOutlook = null;
                }
            }
        }
    }
}

Example on how to call the class:

 var sEmailPath = Path.Combine(Environment.CurrentDirectory, "emails", "single.html");

            var htmlMessage = "";
            if (File.Exists(sEmailPath))
            {
                //Load HTML from file
                htmlMessage = File.ReadAllText(sEmailPath);
            }

            Email.SendWithEmbeddedImages("toaddress@test.com", "Outlook Automation Test", htmlMessage);

email.html:

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
</head>

<body>
    <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td><img src="cid:header"></td>
        </tr>
        <tr>
            <td>
                Hello world!
            </td>
        </tr>
        <tr>
            <td><img src="cid:logo"></td>
        </tr>
    </table>
</body>

</html>

Important Notes and Gotchas

  • CIDs need to be unique. I’ve seen them on all other posts with the format “file.extension@{random #}” but keeping it simple like in the code above worked for me with no issues with Outlook 2016. I did not test on older versions of Outlook to confirm as I no longer have access to them.
  • Outlook ignores font rules in the HTML/CSS you code in the email and defaults to Times New Roman. I know Outlook uses the Word renderer but I have no idea why and the only solution I found was to update the default font in Microsoft Word. Yes, to change the font in Outlook, you’ll need to update the default font in Word. Here’s how to set it:
    • Open Word
      Go to Options -> Advanced -> Web Options
      Change the default font in the Fonts tab
  • Outlook only supports a subset of HTML so don’t forget to test and verify everything as most CSS formatting won’t work in Outlook.
  • Continue Reading
  • 3
  • 176
11th June 2019
AWSDevelopmentLaravelLaravelPHPPHPProgrammingRekognition

How to Extract Text from image using Laravel and Amazon Rekognition API

I’m currently working on a project that requires extracting text from images of variable quality. I’m doing quick prototypes using PHP and Laravel, but I’ve found the documentation for accomplishing this a bit lacking. After working on it for a bit, I figured out a really simple solution and am sharing in case it helps anyone else.

This sample will send the image to the API as a blob instead of using a URL. I had tried Base64 encoding it without any luck. I discovered that using Imagick was the easiest way to make this work so the sample relies on that.

Fire up terminal and add a requirement for aws/aws-sdk-php:

composer require aws/aws-sdk-php

Add keys for your AWS access keys and region to your .ENV file:

AWS_REGION=YOUR_REGION
AWS_SECRET_ACCESS_KEY=ENTER_YOUR_KEY
AWS_ACCESS_KEY_ID=ENTER_YOUR_KEY

Create a controller, add the snippet below, and create a route to the controller. Check the URL and you should have a dump showing the array returned from AWS with all the text, bounding boxes, and information.

        //Build config array for AWS variables
        $config = array(
            'region' => env('AWS_REGION'),
            'version' => 'latest',
            'credentials' => array(
                'key' => env('AWS_KEY'),
                'secret' => env('AWS_SECRET')
            )
        );

        //Replace with path to image or uploaded image.         
        $path = '{path to image.jpg}';

        $image = new Imagick($path);
        $imdata = $image->getImageBlob();

        $client = new RekognitionClient($config);

        $result = $client->detectText([
            'Image' => ['Bytes' => $imdata],
        ]);
        
        //Dump Result
        dd($result);
  • Continue Reading
  • 0
  • 157
28th May 2019
DevelopmentLaravelLaravelmySQLPHPPHPProgrammingSQLSQLWeb Development

How to Execute a Stored Procedure in Laravel 5.6

I’ve been stumped on this and tried everything I can think of but I can’t get Laravel to execute a working mysql query to reorder an ordering column when deleting a row.

Here’s a sample simplified query, which works directly in mysql:

SET @number = 3; UPDATE images SET order = (@number := @number + 1) WHERE id >2 AND project_id = 10

Laravel code that doesn’t update the database but throws no errors:

$sql = 'SET @number = 3; UPDATE images SET order = (@number := @number + 1) WHERE id >2 AND project_id = 10';
DB::raw($sql);

Other things I’ve tried which throw errors including saying there’s an error in the query:

DB::unprepared($sql);
DB::statement(DB::raw($sql);
DB::statement($sql);
DB::update($sql);
DB::select($sql);

I’ve also tried splitting it the statements with no luck:

DB::statement("SET @number = 3;");
$sql = 'UPDATE images SET order = (@number := @number + 1) WHERE id >2016 AND project_id = 10';
$update = DB::update($sql);

I tried a few other things which I didn’t log in Git but I had no luck getting any of it to work. I asked for help on the forums and people told me to use Laravel’s Eloquent model to update rows one by one which is pretty inefficient. You get extra trips over the network (especially important when the code is not on the same server as the database server since you can get dropped calls), extra connections to the server, the extra overhead of processing the query on the server and in the database, etc instead of just having mysql make the update.

The recommended solution may not seem like a big deal but I’ve run into issues where client connections have been dropped mid-update and left a table partially renumbered.

As a last resort and workaround, I opted to use a stored procedure to accomplish my goal. That presented its own can of worms as searching for examples on how to execute stored procedures in Laravel 5.x was also not easy. There’s nothing in the documentation and all the examples I found didn’t work.

Here’s what worked for me with Laravel 5.6, with mySQL 5.6.38:

DB::statement('call spRenumberComments(?, ?)',  [$id, $projectid);

  • Continue Reading
  • 2
  • 141
21st May 2019
AdministrationDevelopmentMacMacMAMPSoftwareSolutionsSSLTroubleshootingWeb Development

Self-signed SSL certificates not working with MAMP and Chrome

I use MAMP Pro for most of my PHP development and Chrome has annoyingly been blocking the self-signed SSL certificates MAMP generates, saying the certificate is not valid and “Your connection is not private”: 

Thankfully, I found an easy solve to fix this. These steps assume you’ve created a host in MAMP. You’ll need to go to the SSL tab of the host you are trying to fix and

  • Check the SSL button
  • Click the self-signed certificate button.
  • Fill in the fields in the dialog modal and click Generate
  • You’ll be prompted to save the certificate. Choose whatever location you’d like.
  • Click on the circle with the arrow to open the directory where the certificate was saved.
  • In the finder window that opens, double click the .crt file (be sure it’s the same file name that’s in the SSL window in case you have multiple).
  • In the Add Certificate window, click Add. I testing adding it to login and system and both worked, so add whichever you prefer.
  • In the Certificates Window, double click the certificate. It’s easier to filter by name if you have a lot of items.
  • In the next modal window, choose Always Trust from the dropdown.
  • Close out the next confirmation window, and you’ll be prompted to authenticate with your mac login to save the updates.

Go back to Chrome, and reload the page and the certificate should work now:

  • Continue Reading
  • 0
  • 151
14th May 2019
DevelopmentProgrammingSoftwareSolutionsTroubleshootingVBAVisioWindows

How to get shape type in Visio using VBA?

I’m working with a Visio 2016 file with over 100 tabs and need to extract the data (mainly text, connector from/to, and shape) for data processing for a processing engine. I was trying to figure out how to get the shape type name in Visio using VBA. For example, in a flowchart, I’m trying to figure out how to tell if a shape is a process, decision, data, etc. The

visShape.Type

property seems to always return 3 which appears to be visTypeShape from https://docs.microsoft.com/en-us/office/vba/api/visio.visshapetypes. After hunting through all the available properties on the Shape object, I found that the shape.Master.Name property will return the shape name, but you need to check if it’s Nothing first in case it’s not a shape.

I didn’t do that and it kept breaking the script originally because some of the pages had text fields and the first few items on the first sheet I was working with were text boxes. Hopefully this snippet will save you the time I wasted figuring it out.

Public Sub GetShapeAndID()

Dim visShape As Shape

    For Each visShape In ActivePage.Shapes
        If Not visShape.Master Is Nothing Then
         Debug.Print visShape.ID & " - " & visShape.Master.Name
        End If
    Next

End Sub
  • Continue Reading
  • 0
  • 99
Load More Page 2 of 9
Newer Posts
  • 1
  • 2
  • 3
  • 4
  • …
  • 9
Older Posts

Tags


.NET (4) Administration (21) Applications (13) ASP.NET (8) ASP.NET MVC (2) C# (6) Caution (4) Debug (6) Development (18) Errors (9) ESET (3) Excel (2) Firefox (2) Fix (19) High CPU Usage (2) IIS (3) Javascript (5) jQuery (4) laravel (5) linux (6) Mac (13) MAMP (3) Memory (2) Microsoft (5) NTFS (2) Open Source (3) Outlook (2) Outlook 2011 (4) Photography (2) php (3) Programming (9) Reviews (2) Sitecore (2) Software (8) Solutions (36) SQL (4) SSL (2) Tips (27) Tools (6) Troubleshooting (24) Useful (18) Utilties (9) Windows (12) Windows 7 (4) Windows Server (2)

Categories


  • Administration 60
    • Caution 3
    • Cloud 7
      • Cloudflare 1
      • Digital Ocean 5
        • Droplet 5
      • Namecheap 1
    • Hardware 4
      • Drobo 3
    • IIS 2
    • Linux 8
      • Apache 1
      • SSH 7
        • Terminal 4
      • Ubuntu 16.04 1
    • Mac 9
      • Software 4
        • Alfred 1
        • MAMP 3
        • PHPStorm 1
      • Terminal 4
    • Review 1
    • Security 6
      • ESET 4
      • Firewall 1
    • SQL 3
      • 2008 1
      • DTSX 1
      • mySQL 1
    • Stupid Tales 2
    • Windows 43
      • Applications 16
      • Malware 2
      • NTFS 2
      • PowerShell 1
      • Reviews 1
      • Software 21
        • Excel 2
        • Outlook 1
        • Peerblock 1
        • Remote Desktop 1
          • RDC 1
        • SourceTree 1
        • Steam 1
        • Synergy 1
        • Visio 1
        • Visual Studio 2013 1
        • Word 1
        • Wordpress 2
          • Hack 2
      • Tips and Tricks 31
      • Tools 21
      • Utilities 19
      • Windows 10 2
      • Windows 7 9
      • Windows 8 4
      • Windows Server 3
        • Windows Server 2008 2
        • Windows Server 2012 2
  • Body Hacking 1
    • Diet 1
    • Soylent 1
  • Development 31
    • AI 2
    • Bitbucket 3
      • Pipelines 3
    • c# 2
    • CouchDB 1
    • Github 3
    • Gitlab 2
    • Open Source 4
    • ORM 1
      • Dapper 1
    • PHP 6
      • Laravel 6
        • Jigsaw 1
    • PHPStorm 1
    • Sitecore 2
    • SourceTree 1
    • Syncfusion 1
  • Mac 10
    • iCloud 1
    • Outlook 2011 2
    • Safari 1
  • Photography 3
    • Food 1
    • Rockstars 1
    • Uproar Festival 2012 1
    • Wolves 1
  • Products 3
    • Backblaze B2 1
    • Reviews 2
  • Programming 30
    • ASP.NET 7
      • MVC 1
    • AWS 1
      • Rekognition 1
    • C# 3
    • Javascript 2
    • jQuery 3
      • Fancybox 1
    • MonoTouch 1
    • PHP 6
      • Laravel 6
        • Tinker 1
    • Regex 1
    • Sitecore 2
    • SQL 1
    • SSL 2
    • VBA 2
      • Microsoft Word 1
    • Web Development 9
      • JavaScript 2
    • WinForms 2
  • Raspberry Pi 1
  • Recipe 1
  • Self Experimentation 1
  • Troubleshooting 44
    • Solutions 43
  • Uncategorized 10

Archives


  • March 2023 (2)
  • January 2023 (1)
  • November 2022 (1)
  • August 2022 (1)
  • October 2021 (1)
  • January 2021 (1)
  • July 2020 (1)
  • May 2020 (1)
  • April 2020 (1)
  • February 2020 (1)
  • September 2019 (1)
  • August 2019 (3)
  • July 2019 (1)
  • June 2019 (1)
  • May 2019 (4)
  • October 2018 (1)
  • July 2018 (1)
  • May 2018 (1)
  • April 2018 (2)
  • November 2017 (1)
  • October 2017 (1)
  • June 2017 (1)
  • May 2017 (1)
  • November 2016 (1)
  • October 2016 (2)
  • September 2016 (1)
  • June 2016 (2)
  • May 2016 (4)
  • February 2016 (1)
  • January 2016 (1)
  • October 2015 (1)
  • September 2015 (1)
  • July 2015 (1)
  • June 2015 (1)
  • May 2015 (3)
  • April 2015 (1)
  • March 2015 (1)
  • February 2015 (1)
  • July 2014 (1)
  • June 2014 (1)
  • May 2014 (1)
  • December 2013 (2)
  • September 2013 (1)
  • July 2013 (1)
  • May 2013 (2)
  • March 2013 (2)
  • February 2013 (1)
  • September 2012 (1)
  • August 2012 (4)
  • July 2012 (1)
  • March 2012 (1)
  • November 2011 (1)
  • September 2011 (4)
  • July 2011 (3)
  • June 2011 (3)
  • February 2011 (1)
  • August 2010 (1)
  • May 2010 (1)
  • October 2007 (1)

Continue Reading
Gregory Varghese

Top Posts & Pages


  • ReportCrash High CPU & How to Disable reportcrash in Mac OSX
  • How to Import Multiple VCF contacts into iCloud
  • Copy File Context to Clipboard via Command Line, Git Bash (Mingw64), or Terminal
  • Why I'm switching from Namecheap to Cloudflare
  • How to deploy a React app to Amazon S3 using Gitlab CI/CD
  • How to Extract Text from image using Laravel and Amazon Rekognition API
  • How to repair permissions on Linux Apache /var/www/html folder
  • How to execute SSH command with Bitbucket Pipelines
  • (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 - error
  • How to Setup a CI/CD Pipeline for Storybook.js using Gitlab

Recent Posts


  • A sonnet about Batman in the style of William Shakespeare
  • AI Experiments Featuring Monkeys
  • How to Delete Folder with Special Character in Windows 10/11
  • Using Laravel Vite with MAMP
  • Deploying Storybook via Gitlab Pipeline via SFTP

Copyright © Gregory Varghese. 2023 • All rights reserved.

Onyx WordPress Theme by EckoThemes. Published with WordPress.