matze's blog

USB-Redirection funktioniert nicht mit VMWare view

Wenn USB-Redirection mit vmware-view nicht funktioniert und folgende Fehlermeldung im Ereignisprotokoll (System) auftaucht:

Es wurde eine schwerwiegende Warnung generiert: 20. Der interne Fehlerstatus lautet: 960.
Quelle: Schannel
Ereignis-ID: 36888

Kann man diesen Fehler beseitigen, in dem man das TLS/SSL-Zertifikat löscht:

Start->mmc.exe->Snapin hinzufügen->Zertifikate->Computerkonto->OK

VMWareView->Zertifikate

Dort das Zertifikate löschen und den Rechner neu starten. Das Zertifikat wird automatisch neu erstellt.

c++ filehandling with unicode paths on windows

windows ansi functions lack of proper utf-8 support. this is why opening/writing files in a folder with unicode chars fails. with this wrapper this isn't an issue any more:

std::wstring s2ws(const std::string& s)
{
const size_t slength = s.length() + 1;
const int len = MultiByteToWideChar(CP_ACP , 0, s.c_str(), slength, 0, 0);
wchar_t* buf = new wchar_t[len];
MultiByteToWideChar(CP_UTF8, 0, s.c_str(), slength, buf, len);
std::wstring r(buf, len);
delete[] buf;
return r;
}

FILE* lslopen(const std::string filename, const std::string mode)
{
#ifdef WIN32
return _wfopen(Util::s2ws(filename).c_str(), Util::s2ws(mode).c_str());
#else
return fopen(filename.c_str(), mode.c_str());
#endif

}

instead of opening a file with fopen, call lslopen and then use FILE as usual.

shrink places.sqlite from firefox

sometimes places.sqlite can become quiet big and slow down firefox. to clean up its possible to delete old history data with some sql-commands:

$ sqlite3 places.sqlite
delete from moz_historyvisits where visit_date < strftime('%s', 'now', '-1 month') * 1000 * 1000;
vacuum;
.quit

this will delete all recent visits older than 1 month.

get own phone numer

to get your own mobile number try to call
*100#
*#135#
*135#

show not connected devices in devicemanager

to remove not connected devices from windows, run cmd.exe, type:

set devmgr_show_nonpresent_devices=1
start devmgmt.msc

then select "View" -> "Show hidden devices"

now you can delete non-used drivers /devices.

How to convert all tables from InnoDB into MyISAM

To change the table type for all tables on a mysql database use this code snippet:

<?php
mysql_connect('localhost','root', 'password');
$dbs = mysql_query("show databases");
while($db = mysql_fetch_row($dbs)) {
if ($db[0]=="mysql") continue; //skip system table
mysql_select_db($db[0]);
$rs = mysql_query("SHOW tables");
while($row = mysql_fetch_array($rs))
{
mysql_query("ALTER TABLE ".$row[0]." ENGINE=MYISAM");
}
}
?>

Kamera verloren / (geklaut?!)

Leider habe ich meine Kamera, eine Sony DSC-W12 verloren.

Die Seriennummer ist 1655711. Die Kamera ist schon ca. 8 Jahre alt, darum ist nur der Verlust von einigen Bildern das schlimme.

Wer sie findet, bitte bei mir melden, es gibt natürlich Finderlohn :-)

force a reboot in linux

if a server badly crashed but is still reachable via ssh, then a reboot can be forced:

 echo b > /proc/sysrq-trigger

this is similar to pressing the reset button :)

for more info see http://en.wikipedia.org/wiki/Magic_SysRq_key

How to check if windows system is 32 or 64 bit in batch/cmd file

if "%PROCESSOR_ARCHITECTURE%" == "x86" (
echo "System is 32 bit"
) else (
echo "System is 64 bit"
)

There are some other solutions, too, but this seems to be the most efficient. This way only works, if you are using the 64 bit cmd.exe:
http://stackoverflow.com/questions/1738985/why-processor-architecture-al...

Microsoft has a solution, too, but it required to create a temp-file:
http://support.microsoft.com/kb/556009/en-us

Also interesting is maybe this article:
http://marsbox.com/blog/howtos/batch-file-programfiles-x86-parenthesis-a...

if not "%ProgramFiles(x86)%" == "" (
set ProgRoot=%ProgramFiles(x86)%
)
echo %ProgRoot%

outputs: C:\Program Files (x86

Pages

Subscribe to RSS - matze's blog