"Illegal scheme supplied, only alphanumeric characters are permitted"
Front-end engineering and so on
30 January 2012
Magento 1.6.1 setup doesn't work if you have wrong date/time on server
"Illegal scheme supplied, only alphanumeric characters are permitted"
30 December 2010
getCookie() example from w3schools defines extra global variables
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
What's wrong? This function defines 2 global variables: c_start and c_end.
Author should learn how to use var keyword in JavaScript. But 10 minutes later I found following page and realized that it's just copy-paste from very popular website:
http://www.w3schools.com/JS/js_cookies.asp
Really not good. W3schools have to fix it. People doesn't learn JS, they just do copy-paste.
23 December 2010
RAID 0 vs. RAID 1 on AMD SB770 motherboard chipset
I read a lot about RAID arrays, types, reliability, performance. And found that not all RAID 1 implementations do distributed read requests in order to increase read speed. The main idea of RAID 1 is redundancy. So, my motherboard's chipset supports RAID 1. It just supports it. Only essential functions. There is no double read speed. Probably other vendors implement this feature, but not AMD.
Today I've tried RAID 0. In short words it gives significant speed up according to HD Tune. Average speed of read is 216MB/sec. It's just benchmark, let's see how it performs on home PC. And yes, I know that my data is under double risk now :)
P.S. I can't get rid of idea of buying discrete sata raid controller.
P.S.S. During usage of RAID 1 I've found that Linux sees raid as 2 separated disks: sda & sdb (at least Gentoo Linux from installation CD). I think it requires proprietary drivers.
10 September 2010
Принцип взаимокомпенсации ошибок
Нельзя удалять по одной ошибке, только парами…
13 June 2010
Habrahabr: Мысли вслух о протоколе X
http://habrahabr.ru/blogs/linux/96305/
(Осторожно, статья создает ложное впечатление, о том что мир Linux в опасности)
14 May 2010
IE + navigator.cookieEnabled => security warning
"This page has an unspecified potential security risk. Would you like to continue?"I was very surprised when received this message. There is no special exceptions of "Permission denied" kind and also you can't handle it via using window.onerror event. The source of this warning was in the usage of navigator.cookieEnabled property. I just needed to know whether cookies are enabled.
- Yes/No
I fixed it by using small workaround: create cookie and try to read it. In case of disabled cookies you will no be able to read it.
function cookiesEnabled() {
var name = "__test_cookie__";
document.cookie = name;
return (document.cookie.indexOf(name) != -1);
}Honestly saying that was not default IE browser. IE was used as a component in another software to render web-pages. I assume it's running in some specific security/privacy mode.
20 March 2010
IIS6: How to add new ServerBinding with PowerShell 1.0
It looks like pretty simple task - just to add new item to ServerBindings array in IIS website configuration object. But I spent near 3 hours to get to working script. You can found different samples in C#, but nothing completely working on PowerShell 1.0 + WMI.
Main issues:
- You can't add new item to $site.ServerBinding, because it is read only list. But you can replace it. You have to act in following order:
- create generic list
- copy all existing bindings to it
- add new binding
- convert to array and replace existing list of bindings
- You can't simply create new list item by calling code like "New-Object -type ServerBinding", because you don't know actual class name (it derived from System.Management.ManagementBaseObject). You even can't clone existing binding, because there is no method .Clone()
You should use classes ManagementScope, ManagementPath and ManagementClass from System.Management namespace to create new binging.
Source code:
function AddServerBinding($siteName, $hostName, $port, $ip) {
function _New-GenericList {
param ([Type]$Type)
$base = [System.Collections.Generic.List``1]
$qt = $base.MakeGenericType(@($Type))
New-Object $qt
}
function _New-ServerBinding {
$scope = new-object -type System.Management.ManagementScope("\\.\root\MicrosoftIISV2")
$scope.Connect()
$managementPath = new-object -type System.Management.ManagementPath("ServerBinding")
$classBinding = new-object -type System.Management.ManagementClass($scope, $managementPath, $null)
return $classBinding.CreateInstance()
}
# get web site configuration
$site = Get-WMIObject -query "select * from IIsWebServerSetting where ServerComment='$siteName'" -namespace "root\microsoftiisv2"
# create list of bindings
$bindings = _New-GenericList -Type System.Object # If it doesn't work, change the type to System.Management.ManagementBaseObject
# copy old bindings
foreach ($item in $site.ServerBindings) {
$bindings.Add($item)
}
# add new binding
$newBinding = _New-ServerBinding
$newBinding.hostName = $hostName
$newBinding.port = $port
$bindings.Add($newBinding)
# save site configuration
$site.ServerBindings = $bindings.ToArray()
$site.Put ()
}
Usage example:
AddServerBinding "SampleWebSite" "www.example.com" 80 $null
Source code as dedicated page >>