Posts

Showing posts from January, 2019

DB backup under SQL Express

SQL Express has no Jobs engine. And Shared SQL server as well. So Management->Maintenance Plans is not exists. So there is a batch file that you can put in Windows Scheduler to create db backups: @echo off set databaseName=%1 echo %databaseName% set backupFolder=%2 echo %backupFolder% for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a" set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%" set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%" set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%" echo %fullstamp% set OutDir=%backupFolder%\%databaseName%_%fullstamp%.bak echo %OutDir% sqlcmd -S <serverName\instanceName> -U <user> -P <pass> -Q "BACKUP DATABASE [%databaseName%] TO disk='%OutDir%'" References :  Filename timestamp

Decimal number issue from server to client. Wow! Didn't expect this @_@

Image
Chapter 17   where poor Decimal Number came from Server Side to JavaScript I worked on some page for days to adjust UI by CSS and HTML changes. It was pretty OK and fine. Until I started to check this page for multi-lingual support... It was good for English, Spanish and Chinese. And even right-to-left Hebrew! Crooked and askew but working! But not in Russian, no! In Russian it stopped working at all - nothing except static texts and images wasn't appeared. And of course it was an error in JS :-\ (FireFox DevTools): that led me strangely to somewhere to this code: I was staring on this rows and saw nothing wrong there - no missing variables at all. I went to original code in the project to discover the non-rendered rows and saw server variable there: that led me to server side C#: Nothing wrong at all. Here and there - another 10-15 minutes wasted to dumbly running the page again and again and stupidly staring on all these rows in different windows... :-\ Sad... Un

Configuring IIS to allow CORS requests

Image
The problem:   sending ajax requests from HTML5 application on local machine to my API that hosted under IIS on Google Cloud. The facts:  The code looks like:         $.post({             url: apiEndpoint + "Init",             contentType: "application/json; charset=utf-8",             data: data,             success: function (response) {                 logResponse("API response [Init]", response.d);             },             error: function (xhr, status, error) {                 logResponse('Fail to call init API', data);             }         }); The error was looks like: Originally, there was "crossDomain: true" parameter in ajax request but it doesn't help. There were crossdomain.xml and clientaccesspolicy.xml on the server and they were helpless as well. The way: I went to internet for advice and saw many and many solutions for ajax - nothing doesn't help. What I tried: - add to ajax