Skip to main content

Laravel Telescope

· 2 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Laravel Telescope

I don't work as often with Laravel (one of the most famous PHP frameworks) so I'm losing my reflexes a bit when it comes to debugging the code, e.g. when it comes to finding the queries that have been executed, the exceptions that have been thrown, the list of keys that have been created or read from the Redis cache, etc.

By installing Laravel Telescope, we can get realtime information about cache, logs, queries and models, exceptions, ... and this will help a lot to understand how the application is working and what is running.

Telescope is a great help for debugging and understanding your application, and installs like a dev dependency.

The last time I developed a Laravel application and installed it on the test server, I was able to follow what my user was doing in real time, see the exceptions he encountered and correct them ... even before he reported them to me.

Thanks to Telescope, not only did I have a perfect view of what was being collected, but I also had all the context: the user didn't have to tell me ‘That doesn't work...’. (without any details); I had everything at hand.

MS Excel - Connect to a SQL Server database, run a query and get the results - Step by step

· 8 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

MS Excel - Connect to a SQL Server database, run a query and get the results - Step by step

In April 2024, I wrote a small blog post about a VBA script that will connect to a MS SQL database, run a SELECT query to retrieve data and put them in an Excel worksheet.

Let's rewrite this article in a full tutorial. We'll install run a SQL Server database using Docker, download MS SQL Server Management Studio, connect to our SQL Server, create a new database with dummy data and, finally, in Excel, retrieve the list of our customers.

Todo Tree in VSCode

· 2 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Todo Tree in VSCode

When you're working on a large codebase, soon or later you'll find some annotations like @TODO or // TODO put there by people (perhaps you) as a reminder for "Don't forget to (do something)...". And, for sure, these todos remain there months or years because, yup, the programmer forgot they were there.

Personally, I sometimes work on code and comment on the call to a particular method or block. Often during a debugging session (for example on Linux Bash scripts) but, danger, don't forget to remove the comments and return the code to its original state. In that situation, I add a comment like // TEMPORARY just before the first commented line.

The idea behind the Todo Tree vscode addon (you can find the download page here) is to summarise such annotations and display a dashboard with all TODOS, TOFIX, ... and your owns too.

Enable case sensitivity for filenames under DOS

· 2 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Enable case sensitivity for filenames under DOS

This is just ... for fun.

As you know, MS DOS didn't make any differences between MyFile.txt, myfile.txt, MYFILE.txt since DOS isn't case sensitive.

If you don't believe me, just start notepad, type a few characters and save your work once as MyFile.txt then as myfile.txt then as MYFILE.txt. Then look to your folder, how many documents did you have ? Just one.

Under Linux, you would have had three files; not under DOS.

What if we asked DOS to change its ways?

MS Office - Load dropdown from Excel's range

· 6 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

MS Office - Load dropdown from Excel's range

In this article, we'll see how, very easily, we can load an Excel range into a ribbon and display it inside a dropdown.

The idea is to provide a list of values in a ribbon but to not have to hardcode values in the list but, just, to link to a range, anywhere in your workbook.

I've used this technique in many of my Excel application's (i.e. Excel having VBA code).

For this blog post, we'll create a list of periods (YYYYMM) in a worksheet and load that list in our custom ribbon.

In this way, we could offer a nicer user experience by proposing a list and executing, for example, a query to a database to obtain the data for this period (or anything else).

SSH - Autosuggestions with ZSH

· 3 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

SSH - Autosuggestions with ZSH

A few weeks ago, I've posted a SSH - Launch a terminal on your session without having to authenticate yourself article about the ssh command in Linux.

I'm pretty sure, like me, you are tired to use command line like ssh christophe@1.2.3.4 to start a ssh connection because ... you know, you don't need to connect on a server; no, you need to connect to the server where the application is running; you know the name of the MyAmazingApp application but certainly not the name of the server or its IP.

That's the case for me anyway.

So, I need to connect to my vault, in which I list all the information about applications, server names, credentials to be used, ...

It would be pretty cool to run ssh MyAmazingApp no?

Python - Fast API - Create your JSON API in Python in one minute

· 7 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Python - Fast API - Create your JSON API in Python in one minute

TLDR: one minute is the time you'll need to copy/paste two files' content and to run one Docker statement.

Sounds crazy but it's TRUE. You'll just need one minute to create the example provided here below i.e. create your project's directory, create two files and run two Docker statements and ... it's done.

As PHP programmer, when I've taken time to read a blog article about FastAPI I thought Nodidju ! Ç' n'est nén pussibe (For Christ's sake! It can't be true).

With just two files, we'll build our own Docker image with Python and FastAPI installed and to code our REST API application. No more than two!

Impossible to not try immediately and ... wow ... that's TRUE!

Heimdall - Web dashboard

· 5 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Heimdall - Web dashboard

https://heimdall.site/

I've never been a big fan of browser's bookmarks and in fact I have almost none. And, quite logically, I almost never display the favourite bar.

I only visit a few sites on a regular basis and my browser history remembers them; otherwise a famous search engine remembers them for me.

However, I'm not averse to a personalised homepage and I'm quite happy with Heimdall at the moment.

Docker - Install and use Git in a container just like you do on your host

· 4 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Docker - Install and use Git in a container just like you do on your host

So, no need to tell it anymore, I'm doing everything in Docker containers even coding (since I'm coding using devcontainers) but ... till now, I was using git on my host only.

I mean, I need git on my host because I should be able to clone a repository. But the question is: should I use git from my host except for git clone? Can I work in my container and from there do actions like a git push?

My current workflow is: from my host, I'm cloning a repo on my disk then I build Docker image(s), run container(s) and jump in it (like starting my devcontainer). I start too a console in my container to start processes, work on files, ...

From time to time, I push my changes to my versioning system (like Gitlab/GitHub) and here is the point: I need to exit my devcontainer (or use another console), go back to my host and run, from my host, commands like git add . && git commit -m "feat: The great feature I'm working on it" && git push.

Let's see how to improve this process and be able to run git commands from inside our container.

Search your FTP server at lightning speed

· 2 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Search your FTP server at lightning speed

Did you know that using WinSCP, you can run a search on your FTP to find all the documents containing a given string? It's native in WinSCP; nothing more to install but...

However, it's insanely slow; let's see how we can do it better and almost instantaneous.