воскресенье, 3 октября 2010 г.

XSL: node-sets. Get value from variable


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
>
<xsl:output method="xml" omit-xml-declaration="yes" />

<xsl:template match="/">
<xsl:variable name="author-id" ><xsl:value-of select="data/get-advice-last/entry/author/item/@id" /></xsl:variable>
<xsl:variable name="author" ><xsl:copy-of select="data/advice-author/entry[@id=$author-id]" /></xsl:variable>
<div class="h"><h1>Советы</h1><h3>диетолога</h3></div>
<div style="margin-bottom:5px;font-weight:bold;"><xsl:value-of select="data/get-advice-last/entry/title" /></div>

<div style="font-size:.9em;"><img style="float:left;border:1px solid #3D93E5;margin:1px 10px 10px 0px;" src="{$root}/image/2/80/100/5{exsl:node-set($author)/entry/photo/@path}/{exsl:node-set($author)/entry/photo/filename}" />
Рассказывает <xsl:value-of select="exsl:node-set($author)/entry/fio" />,
<xsl:value-of select="exsl:node-set($author)/entry/description" />
</div>
<div><a href="{$root}/advice/{data/get-advice-last/entry/@id}">Читать дальше...</a></div>
</xsl:template>

</xsl:stylesheet>

четверг, 12 августа 2010 г.

Xmarks in Firefox: Can't sync tabs!

Tab sync is generally reliable, but there a couple of gotchas that can cause problems when you're first getting started.

Can't see your tabs?

If you have enabled tab sync in a browser but can't see your tabs in the Open Tabs window, the most likely culprit is your having earlier copied your Firefox profile from one computer to another. Xmarks relies on a unique identifier stored in your FIrefox profile to know which tabs are on which computer, and if those identifiers aren't actually unique, tab data from one computer will overwrite tab data from another. Further, if you have two browsers with the same id, you might not see any data at all because a browser never shows its own tab data.

The fix for this problem is simple: go to the browser whose data you wish to unhide and reset its identifier. Xmarks will automatically create a new one for you. Do this one time only:

  1. Enter about:config in the Firefox address bar.
  2. Find the item extensions.xmarks.machineId.
  3. Right-click (control-click on the Mac) and select reset.

The next time you sync, your tabs should also be synced and be visible elsewhere.

четверг, 5 августа 2010 г.

Internet Explorer warning running swf locally

When previewing files locally on your hard drive that contain active content (for example, JavaScript or Flash), the following security message appears in internet explorer's yellow Information Bar:
"To help protect your security, internet explorer has restricted this file from showing active content that could access your computer. Click here for options ..."

You can resolve this by checking:
Tools -> Internet Options -> Advanced -> Allow active content to run in files on My Computer
(Located in the "Security Section", second line)

воскресенье, 1 августа 2010 г.

Windows: How to enable user environment debug logging in retail builds of Windows

Article ID : 221833
Last Review : October 11, 2007
Revision : 11.4
This article was previously published under Q221833

SUMMARY

The versions of Microsoft Windows that are listed in the "Applies to" section let you modify the registry to turn on debug logging of the user profile and the Windows system policy processes. You can also use this logging to track down problems that are related to the start of Desktop Standard PolicyMaker client-side extensions (CSEs). Debug logging functionality is also available in Microsoft Windows NT 4.0. However, in Windows NT 4.0, this functionality requires a checked (debug) build of the Userenv.dll file.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
154120 (http://support.microsoft.com/kb/154120/) Debugging user profiles and system policies in Windows NT 4.0
You can use debug logging output to troubleshoot problems with user profiles and Group Policy processing.

MORE INFORMATION

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/) How to back up and restore the registry in Windows


Use Registry Editor to add or to modify the following registry entry:
Subkey: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Entry: UserEnvDebugLevel
Type: REG_DWORD
Value data: 10002 (Hexadecimal)
UserEnvDebugLevel can have the following values:
NONE 0x00000000
NORMAL 0x00000001
VERBOSE 0x00000002
LOGFILE 0x00010000
DEBUGGER 0x00020000
The default value is NORMAL|LOGFILE (0x00010001).

Note To disable logging, select NONE (0x00000000).

You can combine these values. For example, you can combine VERBOSE 0x00000002 and LOGFILE 0x00010000 to get 0x00010002. Therefore, if UserEnvDebugLevel is given a value of 0x00010002, LOGFILE and VERBOSE are both turned on. Combining these values is the same as using an OR statement.
0x00010000 OR 0x00000002 = 0x00010002
Note If you set UserEnvDebugLevel to 0x00030002, the most verbose details are logged in the Userenv.log file.

The log file is written to the %Systemroot%\Debug\UserMode\Userenv.log file. If the Userenv.log file is larger than 300 KB, the file is renamed Userenv.bak, and a new Userenv.log file is created. This action occurs when a user logs on locally or by using Terminal Services, and the Winlogon process starts. However, because the size check only occurs when a user logs on, the Userenv.log file may grow beyond the 300 KB limit.

The 300 KB limit cannot be modified.

Windows: How to disable security warning ("Не удается проверить издателя")

How to disable security warning ("Не удается проверить издателя"):
gpedit.msc
User Configuration->Administrative Templates->Windows Component->Attacment Manager->Inclusion list for moderate risk file types
прописываем там расширения, для которых не выводить предупреждения (exe, jpg, etc)

понедельник, 12 июля 2010 г.

SquidNT + Windows Seven + NTLM

By default, NTLM-authentication is disabled on Windows 7.
To turn it on, open local security (secpol.msc), then Local Policies - Security Options - Network security: LAN Manager authentication level, set it to: "Send LM & NTLM..."

If your Windows 7 system is Windows 7 Home Premium, you may need to configure it via Registry.
1. Launch regedit from Start Search box.
2. Find the following branch.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa

3. Create a DWORD key under Lsa and set:
Name: LmCompatibilityLevel
Value: 1
4. Restart.

вторник, 22 июня 2010 г.

Symphony CMS + nginx config

My primitive nginx site configuration for symphony-cms  (nginx + php-fpm):

server{
 listen 80;
 server_name mydomain.com www.mydomain.com;
 access_log /var/log/nginx/mydomain.access.log;
 #access_log off;
 error_log  /var/log/nginx/mydomain.error.log;
 client_max_body_size 50m;

 root /var/www/mydomain/docs;
  
 location / {
 index index.php index.html;
 
 if (-f $request_filename){
   access_log off;  
   expires   30d;
   break;
 }
 
### BACKEND
 if ($request_filename ~ /symphony/) {
         rewrite ^/symphony/?$ /index.php?mode=administration&$query_string last;
            rewrite ^/symphony(/(.*/?))?$ /index.php?symphony-page=$1&mode=administration&$query_string last;
        }
        
 ##IMAGE RULES
 rewrite ^/image/(.+\.(jpg|gif|jpeg|png|bmp|JPG|GIF|JPEG|PNG|BMP))$ /extensions/jit_image_manipulation/lib/image.php?param=$1 last;

 ### CHECK FOR TRAILING SLASH - Will ignore files
    if (!-f $request_filename) {
          rewrite ^/(.*[^/]+)$ /$1/ permanent;
     }

     ### MAIN REWRITE - This will ignore directories
 if (!-d $request_filename) {
          rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
          
     }

}

# error_page  404              /index.php;
 
 ## Images and static content is treated different
    location ~* ^.+.(xml)$ {
      access_log        off;
      expires           30d;      
    }


## Parse all .php file in the /var/www directory
    location ~ .php$ {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass   backend;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        
        include fastcgi_params;
        fastcgi_param  QUERY_STRING     $query_string;
        fastcgi_param  REQUEST_METHOD   $request_method;
        fastcgi_param  CONTENT_TYPE     $content_type;
        fastcgi_param  CONTENT_LENGTH   $content_length;
        fastcgi_param DOCUMENT_URI      $document_uri;
        fastcgi_param DOCUMENT_ROOT     $document_root;
        fastcgi_intercept_errors        on;
        fastcgi_ignore_client_abort     off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }

## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;
    }
}
upstream backend {
        server 127.0.0.1:9000;
}

понедельник, 7 июня 2010 г.

ANTIVIRUS. Useful registry tips

1. Вернуть Реестр: В "Пуск" - "Выполнить" вставить следующую команду:

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRegistryTools /t REG_DWORD /d 0 /f

2. Вернуть Диспетчер Задач: В "Пуск" - "Выполнить" вставить следующую команду:
REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 0 /f

3. Проверить:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

Shell=Explorer.exe
вместо
Shell=VirusName

4. Проверить:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"Userinit"="C:\WINDOWS\system32\userinit.exe,"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"PersistBrowsers"=dword:00000000


5. Disable Software Restriction Policy:
    SRP_Disable – включает уровень политики в Unrestricted:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\safer\codeidentifiers]
"authenticodeenabled"=dword:00040000

6. Disable Windows Installer
System Key: [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]
Value Name: DisableMSI
Data Type: REG_DWORD (DWORD Value)
Value Data: (0 = default, 1 = admin only, 2 = disabled)

7. AutoRUN keys

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup


http://support.microsoft.com/kb/137367

8. Delete everything in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\\AppInit_DLLs

9...

вторник, 25 мая 2010 г.

Ubuntu Linux: slow login to SSH server

The solution is rather simple:
sudo echo "UseDNS no" >> /etc/ssh/sshd_config

среда, 19 мая 2010 г.

Permissions to install flash player on Terminal Server

Here is how to fix this problem when using TS. I have tested it both on the 32-bit version of Windows Server 2003 and the x64 version. Works (for me):

1. Download the latest Flash uninstaller on this page: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14157&sliceId=1 and place it somewhere on your hard disk (C:\Temp is a good place)
2. Open a command prompt, navigate to the folder where you placed the uninstaller and run it with the "/clean" option, like this: "uninstall_flash_player.exe /clean" (without quotes - thanks Adobe for so clearly documenting any command line options for this tool...NOT !)
3. Click the Details button. If it lists any files as "Delete on reboot", then reboot now. Otherwise, just carry on.
4. Download the EXE installation package from here:
http://www.adobe.com/support/flashplayer/ts/documents/tn_19166/Install_Flash_Player_9_ActiveX.zip
5. Use the Control Panel Add/Remove programs method to install it. This ensures that the Windows install notification API triggers correctly (as opposed to executing change user /install in a command prompt).
6. Use regedit and find the following key: HKCR\CLSID\{D27CDB6E-AE6D-11cf-96B8-444553540000} (on 64-bit Windows this one is located under HKCR\Wow6432Node\CLSID\{D27CDB6E-AE6D-11cf-96B8-444553540000})
7. Remove any permissions for the Everyone group. click Advanced and tick the box to propagate the permissions to all child objects.
8. Add the Everyone group and give it "Read" permissions on the key. Again, click the Advanced button and propagate the permissions to all child objects.
9. Repeat steps 6 to 8 on the subsequent key, called HKCR\CLSID\{D27CDB70-AE6D-11cf-96B8-444553540000}

Log on as a norrmal user and test it.

Provided that the uninstaller did not report that it needed a reboot in step 3, all this can be done and will start working immediately, even with active users logged on and running several instances of IE on the Terminal Server.

вторник, 18 мая 2010 г.

Ubuntu Linux: Uninstall / Remove Any Installed Software

Uninstall / Delete / Remove Package

Just use the following syntax:
 sudo apt-get remove {package-name}

 For example remove package called mplayer, enter:
 $ sudo apt-get remove mplayer

Remove package called lighttpd along with all configuration files, enter:
 $ sudo apt-get --purge remove lighttpd


To list all installed package, enter:
dpkg --list
dpkg --list | less
dpkg --list | grep -i 'http'

среда, 7 апреля 2010 г.

понедельник, 5 апреля 2010 г.

Раскладка языка при входе в систему

Параметры реестра, отвечающие за раскладку клавиатуры при входе в систему находятся в разделе:
HKU\.DEFAULT\Keyboard Layout\Preload
Достаточно будет на первую позицию поместить желаемую раскладку - 00000409
(английская раскладка) или 00000419 (русская).

Вы можете внести в реестр необходимые параметры, выполнив следующие команды:
reg add "HKU\.DEFAULT\Keyboard Layout\Preload" /v 1 /t REG_SZ /d 00000409 /f
reg add "HKU\.DEFAULT\Keyboard Layout\Preload" /v 2 /t REG_SZ /d 00000419 /f

Чтобы сменить сочетание клавиш, переключающих раскладку, выполните команду:
reg add "HKU\.DEFAULT\Keyboard Layout\Toggle" /v Hotkey /t REG_SZ /d 1 /f

выделенный красным параметр можно менять (1 - ALT+SHIFT, 2 - CTRL+SHIFT). Чтобы переключение работало, необходимо наличие как минимум двух раскладок

Restore MsOffice user settings

In order to restore corrupted Ms Office 2007 user settings, remove the following key from the registry:

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0

More info here: http://support.microsoft.com/kb/822005

воскресенье, 4 апреля 2010 г.

понедельник, 22 марта 2010 г.

Windows 7: Default gateway 0.0.0.0 trouble

Sometimes my nic received correct dchp address, but with faulty default gateway 0.0.0.0 instead of real one. So my LAN was functioning but i didn't have internet access.
Adobe Bonjour service is the cause. Disable it or totally remove with the following command:

"C:\Program Files\Bonjour\mDNSResponder.exe" -remove

вторник, 16 марта 2010 г.

Slow Network copy and connection drops in Windows 7

If you experience Slow Network Connection or file copy from and to the Windows 7 PC or laptop takes ages to completes or connection disconnects then this could be caused by the Task Offload settings. The task offload settings are enabled by default at the NIC level and globally at the system level. This should work for Windows Vista as well.

These could be
TCP Checksum Offload
UDP Checksum Offload
TCP Large Send Offload
IPSec Offload
To quickly resolve the problem, disable Task Offload globally that disable all the above Offload settings by doing the following:
1. Click Start and type “cmd” at the search box.
2. Right-click “cmd” icon and select “Run as Administrator“. This should lainch the command prompt with elevated permisions.
3. Run the following command to check the enabled offload tasks:
C:\Windows\system32> netsh int ip show offload
Interface 11: Local Area Connection
ipv4 transmit checksum supported.
udp transmit checksum supported.
tcp transmit checksum supported.
tcp large send offload supported.
ipv4 receive checksum supported.
udp receive checksum supported.
tcp receive checksum supported.
3. Run the following command to disable all Task offloads:
C:\Windows\system32> netsh int ip set global taskoffload=disabled
also try the following
netsh int tcp set global rss=disabled
netsh int tcp set global autotuninglevel=disabled
netsh int tcp set global chimney=disabled   
OK.
This should disable all the offloads.
4. Disable and Enable the NIC from “Control Panel – Network and Internet Connections – View Network Status and tasks – Change Adapter Settings“.
5. To check if all Offloads are disabled run the following command:
C:\Windows\system32> netsh int ip show offload
Nothing should be listed. This should help.
Also you may try disabling the power management option on the NIC as follows:
1. Click Start, right click “Computer” select Properties.
2. Click Device Manager. Right-click your NIC and choose Properties.
3. Choose Power Management tab and uncheck “Allow the computer to turn off this device to save power.
4. Restart the computer and check if it works.
This should help especially with the Network disconnects.

Additional solution. Disable Remote Differential Compression.


1. Click Start – Control Panel – Programs – Trun Windows features on or off
rdc
2. Uncheck “Remote Differential Compression” and click OK.
3. Restart the computer and you should see an improved performance with copying files.

Source:  http://www.windowsreference.com/windows-vista/slow-network-copy-and-connection-drops-in-windows-7/
Source: http://www.windowsreference.com/windows-7/slow-network-file-copy-issues-in-windows-7-caused-by-remote-differential-compression/

понедельник, 15 февраля 2010 г.

понедельник, 18 января 2010 г.

Windows 7: where is control userpasswords2 ?

Windows 7 now doesn't recognize the command 'control userpasswords2' in Start search box. Instead you can launch it through the command-line (or by typing Win + R).
Moreover you can type 'ntplwiz' in search box to open the Advanced User Accounts applet.

пятница, 15 января 2010 г.

Disabling the Office Clipboard

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows


When you add the following registry entry, it prevents the Office Clipboard from automatically appearing when you perform multiple Copy commands in any of the Office programs. To add the AcbControl registry entry, follow these steps:

1. Quit any programs that are running.
2. Click Start, and then click Run. Type regedit and click OK.
3. In the Registry Editor, click to select the following subkey (folder):
HKey_CURRENT_USER\Software\Microsoft\Office\9.0\Common\General
4. On the Edit menu, point to New and click DWORD Value. With New Value #1 selected, type AcbControl, and then press ENTER.
5. On the Edit menu, click Modify. In the Edit DWORD Value dialog box, click Decimal under Base. Type 1 in the Value data box. Click OK and quit the Registry Editor.


NOTE: To turn on the Office Clipboard, repeat step 5 above, changing the value from 1 to 0.