Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Friday, May 04, 2018

Online tests for Google Analytics and Tag Manager

I've spent a lot of time setting up and testing different actions using Google Global Site Tag.

Moreover there are at least 3 different versions of installation codes for Google Analytics plus Google Tag Manager.

So I've gathered all these codes in one website and added some testing tools there. For example, you can generate any event on the fly.

Installation Codes and On-line Tests for Google Analytics and Google Tag Manager.


Sunday, May 01, 2016

PHP scripts inside HTML on webserver with FCGId

There are lots of articles how to enable PHP scripts inside .html files using AddType and/or AddHandler directives in the Apache web-server configuration file.

But if you have the hosting with PHP engine is running as FCGId module, all these tutorials will not work or will issued downloading of the binary file instead of opening the HTML content in the web-browser :(

Here is a workaround that works for me, just modify .conf file of your website in the following way:


DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/xyz/public_html>
...
RemoveHandler .html
AddType application/x-httpd-php .html
AddHandler fcgid-script .html
FCGIWrapper /home/xyz/fcgi-bin/php7.2.fcgi .html
...
</Directory>

The "magic" comes in AddHandler + FCGIWrapper detectives. Enjoy :)

P.S. If you have HTTP and HTTPS websites, don't forget to configure both Apache .conf files!


Wednesday, April 15, 2015

How to assign reserved IP to existing Virtual Machine in Microsoft Azure Cloud


I don't know why Microsoft cannot offer a single click tool to add a permanent static IP to any Azure resource. Moreover I don't understand why it is not possible to assign a reserved IP address to an existing Virtual Machine :(

The only way (as of April 2015) to assign a permanent public IP address (reserved IP) to Virtual Machine in Microsoft Azure Cloud is the following:

  1. Stop Virtual Machine
  2. Make captured image with a custom name ("image-of-virtual-machine" for example)
  3. Manually write out all Endpoints (insane!)
  4. Delete VM and associated Cloud Service
  5. Create Reserved IP using Azure PowerShell
  6. Create a new Virtual Machine from the saved disk image
  7. Set back all Endpoints manually (insane again!)

If you have finished deleting of Virtual Machine at step 4, start Microsoft Azure PowerShell. Creating of Reserved IP is easy, just a single command call:


New-AzureReservedIP -ReservedIPName "reserved-ip-address-for-your-vm" -Label "SomeTextHere" -Location "North Europe"

To verify that Reserved IP was successfully created, call:


Get-AzureReservedIP

We've got Reserved IP, so it's time to create a new "old" Virtual Machine.

First of all call this command in Microsoft Azure PowerShell:


Get-AzureSubscription

You'll get something like that:


SubscriptionId : 123456-e123-1234-a123-1234567890
SubscriptionName : BizSpark
Environment : AzureCloud
SupportedModes : AzureServiceManagement,AzureResourceManager
DefaultAccount : some@some.com
Accounts : { some@some.com }
IsDefault : True
IsCurrent : True
CurrentStorageAccountName :
TenantId : 00000000-0000-0000-0000-000000000000

If CurrentStorageAccountName is empty set it to the value you can find in Azure Management -> Storage.


Set-AzureSubscription -CurrentStorageAccountName "get_id_from_web_panel_something_like_portal23423ns43" -SubscriptionName "BizSpark"

Otherwise you've got strange errors on next steps, for example:


New-AzureVMConfig : Must specify MediaLocation or set a current storage account using Set-AzureSubscription.

Now we can create a new virtual machine from the saved image with reserved ip address. Lots of tutorials offer to call the following command (don't do it):


New-AzureVMConfig -Name "your-virtual-machine-name" -InstanceSize "Small" -ImageName "image-of-virtual-machine" | New-AzureVM -ServiceName "could-be-same-as-vm-name" -ReservedIPName "reserved-ip-address-for-your-vm" -Location "North Europe"

But in 99% you'll get error:


New-AzureVM : BadRequest: A ProvisioningConfigurationSet was not found in the ConfigurationSet collection of the virtual machine with name your-virtual-machine-name. When creating a virtual machine from an image, ProvisioningConfiguration Set must be specified.

So add Add-AzureProvisioningConfig section into the command (call this):


New-AzureVMConfig -Name "your-virtual-machine-name" -InstanceSize "Small" -ImageName "image-of-virtual-machine" | Add-AzureProvisioningConfig -Linux | New-AzureVM -ServiceName "could-be-same-as-vm-name" -ReservedIPName "reserved-ip-address-for-your-vm" -Location "North Europe"

BTW, don't set any LinuxUser/AdminUsername or Password if you are creating Virtual Machine from disk image, otherwise you've got an error:


New-AzureVM : BadRequest: No Configuration Set should be specified while using a VMImage with a specialized OS Disk Configuration.

Almost done, you'll get a new virtual machine with the permanent public IP running in a few minutes.

Don't forget to add all endpoints! I prefer to do that using web interface. Also update internal IP address for all services on the Virtual Machine. New VM has a different IP address, either public or internal one.

Hope that helps and there were no problems on the Azure side while you are following these instructions :)

Why is it so hard?!




Wednesday, August 27, 2014

Need cool art for website or presentation?

Absolutely amazing online service with hundreds templates of different hardware devices (phone, tablets, laptops, etc.) where you can upload own picture of the screen to get the perfect art for website, presentation or brand-book.

This picture is created using Place.To:

P.S. Why I didn't do such service few years ago? :)


Thursday, March 20, 2014

How to detect Internet Explorer 10 and higher?

For a long time detecting of Internet Explorer browser was easy using Conditional Comments, something like:

<!--[if IE]>
 <script type="text/javascript">
  var isIE = true;
 </script>
<![endif]-->

Starting version 10, Internet Explorer doesn't support conditional comments feature :(

Here is the JavaScript code to detect IE of any version since 5 till 11:

var isIE = (function(){
    var undef,rv = -1; // Return value assumes failure.
    var ua = window.navigator.userAgent;
    var msie = ua.indexOf('MSIE ');
    var trident = ua.indexOf('Trident/');

    if (msie > 0) {
        // IE 10 or older => return version number
        rv = parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
    } else if (trident > 0) {
        // IE 11 (or newer) => return version number
        var rvNum = ua.indexOf('rv:');
        rv = parseInt(ua.substring(rvNum + 3, ua.indexOf('.', rvNum)), 10);
    }

    return ((rv > -1) ? rv : undef);
}());
 

Hope Internet Explorer 12 and higher will work the same way :)


Tuesday, August 13, 2013

Websites at Different Screen Resolutions

If you are creating a lot of web pages, or have a bunch of own websites, you know how important it is to make the HTML documents are looking good for each user. Different formats of monitors (4x3, 16x9, 16x10), lots of screen resolutions (1366x768, 1920x1080, etc), the variety of mobile devices, half of them with automatic rotation of the screen ... What the hell?

So I've created a simple online web service to view any web page at different sizes and resolutions.

By the way, it's free :)

Thursday, December 20, 2012

KARPOLAN's Life by ANIMOTO


Cool video I've created using Animoto web service: KARPOLAN's Life

Monday, November 12, 2012

Did you remember this?

If you are old enough to remember Windows 95 or 98, this is for you:
Black screen at the end.

Friday, September 07, 2012

Landing pages in 5 minutes!


New web service RocketStart.Me allows anybody to create cool looking landing pages for any product, person, event, and so on.

It works as SaaS (Software as a Service), so you do all tasks right in the browser, no software downloads required!

Everything you need is just create account, choose the page template and put some text, media, links, social buttons or other "blocks you want" there. It took less than 5 minutes to create such page:

KARPOLAN at RocketStart.Me

Cool service indeed, I'm planning to make landing pages for every my software product!


Sunday, August 05, 2012

IFTTT Challenge

Testing IFTTT service.

Notification about this post should appear in @karpolan twitter

Sunday, July 22, 2012

Back to Shareware :)

I have never ever planned back to shareware business, but one of my technical tasks requests testing of modern software protection and integration with billing services. So I've decided to make a small utility and push it to all required tests.

I have many ideas and feature requests form users of free Keyboard LEDs software, so there was no problem with idea of new software. So, here it is: Caps Lock Indicator

Caps Lock Indicator software for Windows
Download EXE file
Download ZIP Archive

Software for Windows, offers two Caps Lock state indicators: Tray Icon and On-Screen Floating Text. Notifications by sound are also available. The product is distributed as shareware with 30-day trial period. The license costs $9.95 per user.

Wednesday, July 04, 2012

Picture of the Day

I've created own Picture of the Day service.

It took about 3 hours at night while I was fighting the insomnia...

Monday, June 25, 2012

Random Color Generator and Preview


I've created the online color viewer.

Everybody can preview any color using this base URL: http://karpolan.com/services/color/

Want to see a green color? Here it is: http://karpolan.com/services/color/008000/

A dark blue one? No problem: http://karpolan.com/services/color/000060/

Also, there is the Online Random Color Generator there.

Wednesday, June 06, 2012

Friday, October 28, 2011

PHP - Print any variable easily

You often need to print some PHP variable right into the HTML code, but the variable is out of your current scope. Familiar problem, isn't it?

Here is a bright solution: PHP function that prints any global variable:


function print_var($var = 'domain', $url = '')
{
  global $$var, $$$var;
  if ($url != '')
    echo("<a href=\"$url\">${$var}</a>");
  else
    echo(${$var});
}

Moreover, you can pass some URL as a second parameter, and your variable becomes a clicable link :)

Some examples:


<?php print_var('page')?>
<?php print_var('domain', '/') ?>
<?php print_var('software', '/download/') ?>
<?php print_var('author', 'http://www.site.com') ?>

Sunday, October 16, 2011

Wordpress + Custom Scripts = Error 404

Wordpress is the most popular CMS in the world. Many sites are powered by Wordpress, plugins almost for every need are available. But...

If you decide to add some custom web scripts or other CMS to the domain where Wordpress is already installed, you'll get a problem with Error Handling. Wordpress shows Error 404 (File not found) for any URL that is not a part of Wordpress system!

Moreover, Wordpress changes standard error pages to its own ones. So if an error occurs outside Wordpress environment, the error message appears in Wordpress style anyway!

This can be fixed using .htaccess settings. At first you should exclude work folders form RewriteMode redirections. Add the following line into .htaccess file in the root of your site:

RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/(folder1|folder2)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress /index.php [L]

Then you should disable custom error page, at least in folders of your scripts. Add the following line to .htaccess files in your script folders. You can add this line to the root file as well, but sometimes it doesn't work:

ErrorDocument 404 default

This is enough if Wordpress is installed into a folder. But if Wordpress is installed into the root of the site, the solution may not work depending on CMS version and installed theme. Most probably you will need to fix some files manually to disable 404 error handling. The core is located in class-wp.php file:

function handle_404() {
...
$wp_query->set_404();
status_header( 404 );
...
}

BTW, Wordpress in the root of the site is not a best practice...


Monday, June 20, 2011

List of USA and Canada States

Same to the countries list I'm publishing the list of USA and Canadian states:

Hope this helps somebody :)

Hint: Click on list, press Ctrl+A to select all, Ctrl+C to copy the list.

Country List

Every time I create the user panel in some program or website I'm searching for a list of countries for dropdown (combo box) options control. So I decide to palace such list in a public place:

This is ISO 3166 Country Name list. Maybe other people will be happy to use this list in own projects :)

Hint: Click on list, press Ctrl+A to select all, Ctrl+C to copy the list.

Saturday, January 16, 2010

Twitter plugin is hacked!

Twitter plugin seems to be hacked! See difference between Twitter via RSS and Twitter via Plugin in sidebar of this blog.