An introduction to database migrations in Yii

If you’re new to Yii migrations, these sources might be a help for you:

  1. General information: Database Migration topic in The Definitive Guide to Yii.
  2. How to create initial migration basing on current database state, explains this Stack Overflow question and GitHub Gist (with InitialDbMigrationCommand class’ code) to support it.

To use migrations, you have to properly configure console version of your Yii application. Details follows.

Read More “An introduction to database migrations in Yii”

Undo last Git commit using git undo-commit command

There are probably thousands of websites telling you, how to undo the last Git commit. For example, one of the most voted up questions on Stack Overflow. But none of them (or actually nearly none of them) answers, how to do this using git undo-commit. Simply because, such command does not exist! :> Therefore, the title of this text should rather sound “Defining own Git alias to undo last Git commit“, since this article is focused on git aliases rather than on undoing last commit in Git.

Read More “Undo last Git commit using git undo-commit command”

Error 1618 when installing any software on Windows

You can find this error during for example Skype or Java Runtime Environment installation. And probably many more. It just means that another program’s installation is in progress and current one can’t continue.

It happens in most case, when you try to install some software, when Windows Update is installing heavy portion of updates. And current program can’t install or update some system elements, that are being updated by Windows Update in the same time.

Solution? Wait some time (until end of Windows Update process?) and then restart installer of your program.

Offline installer for Microsoft Office 2010 and other products

Microsoft has changed offline installation policy and you can’t download any offline installer, until you don’t provide your product key and you don’t login with your Microsoft account. If you don’t have it or you don’t want to use it, then the only option, you’re left with is to download offline installer from unofficial sources.

Read More “Offline installer for Microsoft Office 2010 and other products”

Differences between SSH key generated by ssh-keygen and Puttygen

There are some key differences between SSH keys generated by ssh-keygen and Puttygen so you may run into problems importing or adding keys generated by the latter one, while importing ssh-keygen‘s keys goes swimmingly.

Here are some tips on this problem. Of course, we’re talking about public SSH keys, as private one are secret and shouldn’t be added or imported anywhere.

Read More “Differences between SSH key generated by ssh-keygen and Puttygen”

Access Send To menu in Windows [updated]

No, you don’t need to install any extra program, to edit contents of Send to... context menu in Windows (source).

Instead, open any Explorer window and paste this as folder path:

%APPDATA%\Microsoft\Windows\SendTo

or hit Win+R, enter or paste shell:sendto and hit Enter.

This was proven to work in Windows 7 and 8. Most likely this works in Windows XP, Vista and 2000 as well.

[update] This still works nine years after writing this article, in Windows 10 and 11.

Make a webpage looking like terminal or command-line

So, you’d like to make a webpage that looks like terminal or command-line, right?

With a little bit of HTML, CSS and Javascript, it is as easy as snapping a finger. Note, that I underlined “looks like”, because we’re going to do just a look & feel. This will not be a full-blown command line interpreter, where you can enter commands and get results. It will only be a simple, cool-looking… thing.

This article is a slight port of the code that can be found at fludotlove.com (done by Nathan Marshall).

Read More “Make a webpage looking like terminal or command-line”

Fine-tuning CKEditor 4’s toolbar

Forcing CKEditor 4’s toolbars to look exactly as you’d like is a bit hard task. Somewhere in official docs it is said, that you should use config.toolbarGroups configuration settings for this purpose. This is, of course, a complete mistake.

Benefits are weak and you’re actually loosing all the control over which button, in which group and in which line of toolbar should appear. This article will help you design CKEditor 4’s toolbars exactly, as you wish to have them, using old, good config.toolbar-way.

Read More “Fine-tuning CKEditor 4’s toolbar”

Sublime Text 3’s user configuration

As you probably know, there are no configuration dialogs, windows or generally any UI to click-through configure your Sublime Text 3. Actually, nearly everything is customized by editing ST3 configuration files.

Default configuration file is very well documented, but it is quite long and may be overwhelming. To help some of you with that problem, I wrote this article, where I show the list of configuration settings that I changed in my own development environment, that you may find interesting or at list worth considering.

Read More “Sublime Text 3’s user configuration”

Making Windows 8 at least usable

Microsoft is a sinusoid, when talking about Windows releases. It always has perfect system followed by a total mistake and nightmare.

Since Windows 7 was a nearly-perfect system (thousand times better that Vista-joke), then we could expect, that Windows 8, that follows it, will be a nightmare, joke and a total mistake. It is.

While we’re waiting for (hopefully “perfect”?) Windows 9, we need to do something to make Windows 8 at least usable. Because, out-of-the-box, this system isn’t usable and is the shortest path to permanent mental illness. If you can avoid Windows 8, then do it, without asking why. If you’re forced to use it, this article should be a start point for restoring your mental stability.

This is rather a check-list (with some coment), what you should do or at least consider, than fully featured article. And, yes! Everything, what is written here, was tested on Windows 8.1, so should work just perfectly on both Windows 8 and 8.1.

Read More “Making Windows 8 at least usable”

Netbeans-like keyboard shortcuts in Sublime Text 3

I’ve been using Netbeans for over five years. Though it is so deadly slow, I didn’t manage to change to Sublime Text 3 (which is extremely fast) up until now. Five years of constant use of some program causes that you get used to it very hard and you’re very opponent to any changes.

This blog entry is supposed to help you configure Sublime Text 3 in the way as close to Netbeans as possible. But, Sublime Text 3 is not Netbeans. You’re able to achieve a lot of similar functionality (plus a lot more of things that you could only dream about in Netbeans), but there still be a span of things that are not replicable.

Read More “Netbeans-like keyboard shortcuts in Sublime Text 3”

Force Sublime Text 3 to auto-pair quotes before semicolon

By default, Sublime Text 3 will not auto-pair quotes (add closing quote, when you enter opening one), when following character is a semicolon (;). This is a little bit unhandy for PHP developers.

But, since nearly everything in Sublime Text 3, this can be easily tweaked, by changing ST3 configuration.

You’ll find all the details in this wonderful Stack Exchange answer, made by MattDMo after my question asking, how to fix this problem.

Read More “Force Sublime Text 3 to auto-pair quotes before semicolon”

Useful plugins for Sublime Text 3

Sublime Text 3 is powerful and really kicks ass even in its bare installation. But, when you power it up with proper combination of plugins it simply kills entire life on the planet!

Package Control claims to have over 1800 plugins for Sublime Text 3. Browsing this number of them seems impossible. Many of them are abandoned, some are for very specific reasons.

In this article I am only listing just a few plugins that I am using within Sublime Text 3.

If you’re reading this text, I assume, that:

  • you have Package Control installed and
  • you’re after reading my Beginning with Sublime Text 3 article.

If not, skip back and pass these two points.

Read More “Useful plugins for Sublime Text 3”

non-YiiBooster fields with YiiBooster prepends

I don’t like the idea of rewriting my entire application’s view to use new Bootstrap 3, so my Yii apps remain on Bootstrap 2, served by YiiBooster extension. The biggest problem, I find in it is that its controls have prepends somehow “built-in”.

Both field and its prepend is rendered with one line of code. So, when you want to replace any YiiBooster’s control with for example own widget / library, you always remove one line, but looses both field and prepend.

I found ugly and nasty workaround for this.

Read More “non-YiiBooster fields with YiiBooster prepends”

ALWAYS check manufacture date of the battery, you purchase!

I have put my own and Izzy‘s answer on Android Stack Exchange to formulate this check-list or rather list of importance for things that you should consider when purchasing a new battery.

tl;dr: Li-Ion batteries stored in store or warehouse without cyclic re-charging (which most likely never happens in these scenarios) are completely dead after 20 months at most. Thus, you should never, ever purchase any kind of battery that is two years old or more. No matter what seller says.

Read More “ALWAYS check manufacture date of the battery, you purchase!”

close up photo of programming of codes

CTags and Goto source definition in Sublime Text 3

One of the most important functionality of each high class IDE is “Goto source definition” mechanism, which let you click particular symbol (i.e. class or method name) in any source file of your project and be immediately redirected to file (and line) that contains its definition.

Sublime Text 3 is not supporting this functionality natively. But, we can add it quite easily, using CTags plugin.

Read More “CTags and Goto source definition in Sublime Text 3”

Cyclic jobs in Yii and MySQL

When we are talking about some cyclic tasks executed periodically in PHP, most of us automatically thinks about CRON. It is not surprising, since it is very popular, easy to manage (available often even on shared hostings) and easy to code (it simply fires given PHP script).

However, there are four other ways you can achieve exactly the same in Yii/PHP. And many Yii developers may not be aware about some of them.

Read More “Cyclic jobs in Yii and MySQL”

Remove “Edit with Notepad++” option from context menu

One of the newest updates of Notepad++ has introduced new, quite annoying Edit with Notepad++, item added to many context menus. Since, there isn’t an option in Notepad++ itself, to remove it, you have to solve the problem yourself, by unregistering one of Notepad++ services.

There’s a solution that:

  • doesn’t require you to tweak with the registry or
  • download and install or run any program.

All you need is to use a command line in administrator mode and follow five quite simple steps.

Read More “Remove “Edit with Notepad++” option from context menu”

SublimeCodeIntel and Code intelligence in Sublime Text 3

There’s an article about using CTags plugin to implement “Goto source definition” functionality in Sublime Text 3 — a mechanism, which let you click particular symbol (i.e. class or method name) in any source file of your project and be immediately redirected to file (and line) that contains its definition. You’ll find it here: “CTags and Goto source definition functionality in Sublime Text 3“.

This functionality is often called “Code intelligence” and there is another plugin — SublimeCodeIntel — that implements it in Sublime Text 3. If you want this kind of functionality in Sublime Text 3, but don’t want to use CTags plugin, this article will tell you more about alternative to it.

Read More “SublimeCodeIntel and Code intelligence in Sublime Text 3”