Shorthand notation for Yii commands in Git Bash and Windows Terminal

Developing PHP applications in Yii 2 makes you use Yii command-line commands quite often (for example for migrations). Since I am a Windows maniac that uses XAMPP, I have to type:

php yii

before each command each and every time.

A bit tiring so I wanted to make this a little bit easy. For example, to be able to type:

y migrate

instead of:

php yii migrate

Getting there was quite easy for Windows scripts and using Windows Terminal. Things has got a little bit complicated when trying to achieve the same in PhpStorm. Which uses GitBash instead of Windows Terminal.

Read More “Shorthand notation for Yii commands in Git Bash and Windows Terminal”

A very quick introduction to QEMU

If you’re developing your own applications for Raspberry Pi:

There’s a never-ending question on testing your results.

Copying:

  • New version of your app into Linux on your RPi and running it or
  • New disk image to microSD and booting entire device

Doesn’t seems to be a huge problem.

But, when you have to do this dozens of times each day than an emulator-like questions appears.

Read More “A very quick introduction to QEMU”

keepachangelog.com of your stuff?

I am not intend to tell you that you should keep a change log of any piece of software that you ever develop. This is as obvious as the fact that sun shines and fire burns. If you don’t understand this or disagree then you’re certainly at the wrong address.

However, with this article I am going to tell you about a specific way of keeping history of changes to your software. The one that keepachangelog.com suggests. The one that I immediately fell in love with.

Read More “keepachangelog.com of your stuff?”

Temp Mail and Temp Number for QA purposes, but not only…

The Temp Mail and Temp Number services were originally created (according to their owners) to lift of your problem of being bloated with stupid newsletters and SPAM emails and text messages, when you use your actual mailbox address or phone number in order to register to some service.

With these services you can totally forget about such pains because you’re getting a fully working email address or SMS receive-enabled phone number that will self-destruct after twenty minutes or so.

If you are a developer you may already catch an idea that you can use this for a QA purposes.

Read More “Temp Mail and Temp Number for QA purposes, but not only…”

Introduction to curl

This is just a barely memo about very, very basics of curl. Since curl fetches URLs and data from some endpoints, it can be used for a variety of reasons. I am using to for a very basic (and quick!) API calls tests.

If you’re on Linux, Unix or any of its clones or if you’re on Mac then you most likely have curl. If you’re on Windows, but you’re using Git for Windows (or some similar tool) then you have curl.

So, let’s jump into that basics. Be warned — you will not find here anything that you wouldn’t already knew.

Read More “Introduction to curl”

Developing applications for Raspberry Pi or Linux

Depending on: project’s scope, business expectations, your knowledge and Raspberry Pi’s role you can develop software for RPi in mainly three ways:

  1. Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients.
  2. Develop a HTML/CSS/JS application
  3. Develop an native Raspberry Pi app

All of the above require you to:

  • Develop a regular Linux app
  • Optimised to use hardware and computing power of Raspberry Pi
  • Run it in Raspbian OS or any other Linux distribution of your choice

And, if you really want to get your hands dirty and truly have no limits then you must forget about Linux and start thinking about Ultibo (there’s a separate article for that).

Developing in Ultibo (or similar complete embedded development environment) requires a lot of expertise, development knowledge and practice. And simply isn’t an option for all. Especially, if you only need to build a quick-and-easy app for RapberryPi. For these purposes this article lists details about RPi development.

Read More “Developing applications for Raspberry Pi or Linux”

Ultra-fast animated screen capture with LICEcap or ScreenToGif

Up until now I was using fabulous ScreenToGif to quickly capture animated screenshots for bug reporting. It truly is — as its homepage says — free, compact and powerful. It comes with handy installer, but also with portable version. And capturing is ultra-easy with it.

Today I discovered LICECap and immediately felt in love again…

Read More “Ultra-fast animated screen capture with LICEcap or ScreenToGif”

The “Couldn’t agree a key algorithm” error in Git for Windows

When trying to perform any authentication-related operation in Git for Windows you may hit the wall with:

Couldn’t agree a key algorithm (available: list of available methods)

Some people says (here and here for example, but also in many other places) that this is due to your PuTTY not being up-to-date and ordering getting latest version of PuTTY as a cure. You’re lucky, if that works for you! :>

I wasn’t that lucky and it turned out that in case of my Git for Windows TortisePlink was actually the problem.

Read More “The “Couldn’t agree a key algorithm” error in Git for Windows”

Say bye, bye to website screenshot stuff. Chrome DevTools 62 are here!

If you’re using any kind of software or browser’s plugin for capturing entire website, viewport areas longer than current screen or just a small pieces of website then with new Google Chrome DevTools 62 you can say bye, bye to all of them!

You can now capture screenshot of selected node (which includes capturing entire page, as I’ll show you) directly in DevTools in Google Chrome 62.

It is said that you can also capture a screenshot of selected part of viewport, but I managed to get this working only two times per ten on less than 10% of websites. Thus, I decided to not write about it.

Read More “Say bye, bye to website screenshot stuff. Chrome DevTools 62 are here!”

Fresh XAMPP installation — a step-by-step guide

This is more like my private memo, to have a clean check-list of steps I usually undertake, when installing fresh XAMPP for Windows installation. Most steps aren’t unique to my environment, so this article can also help others, that are stuck at some point. Note, that this is purely development environment-oriented installation guide, as XAMPP is not meant to be used as production server.

Read More “Fresh XAMPP installation — a step-by-step guide”

Configure email sending solution under XAMPP

This is the ultimate (at least for me! :]) solution to configuring mail sending in your XAMPP. Verified and confirmed that this is working. If you go through these steps and still have no results, I’m 95% sure, that problem is outside XAMPP or sendmail (i.e. something is wrong with your configuration). I hope, I don’t have to remind you, that every wise guy uses XAMPP only for development purposes and never, ever as stand-alone, production, webserver!

Do not get confused! This article is about fake sendmail, a solution designed for development environments, like XAMPP, to mimic mail delivery subsystem for developers, that is found on production servers. This text has nothing to do with original sendmail, world famous MTA, started 1979 (25 years before fake sendmail!) and still widely used on production servers and anywhere else in hosting area.

Read More “Configure email sending solution under XAMPP”

Enable LDAP support in PHP served under XAMPP and Windows

Connection to LDAP in PHP isn’t that easy task by itself. Things get even more complicated, if you’re working in XAMPP environment under Windows. It hope this article will help you in getting un-stuck, if you’re stuck on the similar things, as I did.

Notice: solution provided in this article may not work for you! It worked on my office computer and failed completely on my home computer, though both are quite similar (same version of Windows and XAMPP etc.).

Since, we’re talking about very stupid system (Windows) and about even more stupid situation (claiming, that file is not found, though it exists in folder listed in PATH variable), I have no bloody idea, why it doesn’t work (or why it does work on certain computers) and how to solve this problem.

Read More “Enable LDAP support in PHP served under XAMPP and Windows”

Git in Netbeans — Push or Push to Upstream

Netbeans’ Git client is a bit different that others (like TortoiseSVN) and offers additional option for push/pull commands (starting from version 7.3). It is Push to Upstream and Pull from Upstream. What is the difference from regular “non-upstream” versions. Not to big. Second (“upstream”) ones offer dirrect execution of command, without displaying any dialog (if properly configured). While regular (“non-upstream”) always opens Push to Remote Repository dialog.

So, after initial configuration, it is more convinient to use Push to Upstream instead of Push.

It is always a few clicks less, right? :]

Read More “Git in Netbeans — Push or Push to Upstream”

Self-documenting code is a myth

How many times did I heard that stupid talk? “Comments aren’t needed! Code should be self-documenting”. If you think this way, then… believe me or not, you’re wrong. Good developer does not need comments to describe, what he or she is doing. But there’s always a purpose for doing something, which must be documented for future reference. If you think, you can achieve the same with self-documenting code, you’re going strictly into violating fourth of Five major software development rules. Which says: “Premature optimization is the beginning of all hell!“.

Read More “Self-documenting code is a myth”

Upgrading MySQL on-board XAMPP

XAMPP is a great package of Apache, MySQL, phpmyadmin and some others (actually the best I’ve ever used). The only disadvantage of it, is that guys behind this project haven’t got much spare time and update it fairly slow. Newest XAMPP version (1.8.1) is over a year old now and still has MySQL 5.1.41 on-board, while version 5.6.10 is available for download, as of writing this. Here are some tips on manually upgrading MySQL on-board your XAMPP package.

Simple copy & folder switch does the job and is enough to upgrade MySQL on-board XAMPP from 5.1.41 to 5.6.10. However there are slight side effects, you must consider.

Read More “Upgrading MySQL on-board XAMPP”

Too long URLs in Apache

It turned out that in current version of Apache you’re limited to 255 characters at most between each pair od slashes (after URL decoding is done). This short article discusses this issue and maybe useful to all developers, who are dealing with “beauty” (SEO-optimized) URLs, like for example URLs to blog posts containing entire title inside.

This is a rare situation (255 characters limit between slashes, not for the entire URL), but still worth exploring.

Read More “Too long URLs in Apache”

Free hosting for ASP

You can find a lot of free hostings for PHP and MySQL, but not that much for ASP and MS Access. In addition to being free, these hostings also offer absolutely not ads, neither on your websites nor in sent e-mails:

100 MB might seem to be very low among nowadays offers (counted in GB or even not limited in space). But since you get: ASP Support, MS Access database and ISS 6 (on Windows 2003), absolutely free for lifetime with 100% no ads, then I think it would be hard to find similar offer with higher storage.

Five major software development rules

To all those, who just don’t get it!

  1. DRY = Don’t Repeat Yourself!
  2. KiSS = Keep it Simple, Stupid!
  3. You ain’t gonna need this!
  4. Premature optimization is the beginning of all hell!
  5. Copy-paste is time waste!

Never, ever forget about these five, if you’re developing anything.

Force HTTP 403 error when there is no index file

If you want to display HTTP 403 error (instead of files list) for folder, where there is no index.html or index.php file, then in .htaccess file you must add following line:

Options -Indexes

This works for current folder and all subfolder (unless .htaccess file if any of these subfolders will “locally” change this setting).