You are here: Hello


Welcome to my corner on the web.
Here you find out few thing about me, read my mostly technology (programming) blog.
All my projects (ongoing & finished) are listed here.

If you with to learn something new- visit my Tutorials section. I hope You'll find something useful here

Latest Blog messages

Reliable way to get date in batch scripting

It's been long time since my last post, but I'm here, and watching :-)

Lately, I've got assignment to create MySQL backup script. It must be automatically scheduled by MS Windows Task Scheduler. As it is automatic, script should create new backup name each time. What is the best way to name backups? Probably to include date of backup.
And here my problems begins. If you grab date file_%date%.bak you may end up in various ways:

  • File can be created and named as you've expected;
  • Back up file does not appear (because of illegal characters used as date separator);
  • Backup file named somehow strangely.

I've tried all various ways to create file names as I wanted to by splitting date into Year, Mont and Day. But when it comes to locale- date can be in imperial style: YYYY/DD/MM
I want universal script to work on all locales or formats, so tried to catch date separator to guess format. This kind of tinkering complicated my script till unusable… And suddenly I step over WMI1) once again. This instrument is life saver. For real!! I have found Win32_OperatingSystem class in root\CIMV2 namespace. And you know what? It has exactly what I need. I just needed to query LocalDateTime property to get Date and time. This property hold my valuables in this format:


This format is independent from locale or whatever else factors, it's allways the same.
Now I see my road bright and clear- I must use WMI to get my date and split it into Year, Mont and Day. This could be done quite simply in batch scripting file:

for /f %%a in ('wmic os get LocalDateTime ^| findstr ^[0-9]') do (set ts=%%a)
ECHO %ts:~0,8%-%ts:~8,4%

This way I get 20130625-0948

So just script your filename as following and you are ready to go

SET filename = %ts:~0,8%.bak
2014/02/04 20:18 · 1 Comment

jQuery UI is now compatible with jQuery mobile

Good news for JQuery developers- two of most popular frameworks becames compatible. Now, jQuery, jQuery-Mobile and jQuery-UI could be used at the same time- no more error any more. Great!!!
jQuery 2.0.3 + jQuery-mobile 1.3.1 + jQuery-UI 1.10.3

In earlier versions I've been sacrificing jQ-UI because of compatibility issues with JQM, but now I'll use full power of jQuery without any additional3rd party plugins.

2014/02/04 20:18 · 1 Comment
1) Windows Management Instrument
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported - Nemokamas lankytojų skaitliukas XHTML